There are various reasons as to why you want to redirect all visitors from a domain to another domain name. I occasionally buy domain names and don’t have the time to setup Websites on the domains immediately; I therefore create a 301 redirect using a very simple PHP file. The redirect can be done using various other means such as using .htaccess (if you Host on Apache HTTP Webserver) or HTML. I just find the PHP 301 redirect method so simple that I really don’t have a need to use another method.
Instructions on creating a 301 Redirect
Here is the two minute guide to redirecting a domain to a new domain:
- Open your text editor.
- Add the following to the text editor
<?PHP Header( "HTTP/1.1 301 Moved Permanently" ) /* SPECIFY THE STATUS CODE */; Header( "Location: http://www.organicweb.com.au" ); /* REDIRECT BROWSER - CHANGE THE URL TO THAT AS NEEDED */ ?>
- Save the file as index.php.
- Using FTP, transfer index.php to the root of your hosting for your domain that you wish to redirect..
Thant’s all. Your domain will now redirect 🙂