Baran Topal

Baran Topal


May 2024
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories


Redirecting automatically from the domain to a facebook page in apache

baranbaran

This was for fun and there are two ways to solve this, on the web server level or in the code level.

So the task is, if visitor goes to www.yourdomain.com then send them directly to www.facebook.com/yourpage

So on apache level,
you’d set an redirect rule in the .htaccess file of yourdomain.com:


Redirect 302 / http://facebook.com/yourpage

I put 302 (temporary) in here, in the event that I don’t want this to be a permanent redirect and plan to develop the domain sometime in the future.
One client code level:









In regards to the javascript redirect, anyone who has script disabled in their browser will not be redirected. They’ll just sit on a blank white page, if that’s all I have in your index file.
With the 302 redirect, the visitor is sent to the new URL regardless of their browser settings.