Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

phadam

macrumors regular
Original poster
Jan 21, 2009
123
0
Looking to redirect my site over to a new more appropriate domain name. Found some great reading on the web about 301 redirects which will be pretty helpful when it comes time to start the work. However, was wondering if anyone has had any prior experiences with the redirecting and any troubles they may have come across or things to look out for and expect through the process. This will be my first attempt and would ideally love for this to go as smoothly as possible. Thanks!
 
PHP:
<?php
$url = $_SERVER['REQUEST_URI'];
Header("HTTP/1.1 301 Moved Permanently"); 
Header("Location: http://www.mysite.com" . $url);

This will redirect the user to the exact page they were wanting to go to on your old site to your new site.

For example
www.myoldsite.com/about to www.mynewsite.com/about


Or you can use the following to redirect all requests to your index page.
PHP:
<?php
Header("HTTP/1.1 301 Moved Permanently"); 
Header("Location: http://www.mysite.com");


I used the first method and it worked perfectly for the site in question. Its google rank moved within a week and the new domain was at the top of the google page for all of the search terms that the old site was.
 
I've got a number of 301 redirects in my .htaccess file. I like them. It just takes a bit of geek to get them working sometimes for fanciful stuff, but a simply domain redirect is easy.
 
great so far. thanks! what about email. i haven't looked into this yet but what's the process involved on getting old email redirected to the new email. Any real complications there as opposed to just a domain redirect?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.