
Sometimes during migration of a new site, the domain is changing too. It’s important to maintain the integrity of the old URLs so that old inbound links and all that SEO juice flows to the new site and domain.
So here’s what we want:
- User clicks any link (like):
www.yourolddomain.com/about/team/ - User is redirected (seamlessly) to:
www.yournewdomain.com/about/team/
Here’s what we’ll do:
It probably sounds incredibly tricky or tedious, but it’s actually quite simple if we make the web server do the work. There’s a special file called “HTaccess” which allows us to tell the server what to do. There’s also something called a ModRewrite module that comes installed on most Linux hosting servers. So all we have to do is tell the server to redirect traffic from your old URL to the new one and append anything to the end of the link they were looking for.
Here’s the script in 3 lines:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.yournewdomain.com/$1 [R=301,L]:
NOTE: This sort of 301 redirect will NOT work unless your server has the Apache ModRewrite module turned on. It usually is, but if it doesn’t work – that’s why.
We make this change to the HTaccess file on your old site and wallah! An SEO and user-friendly redirect that will pass users and pagerank to the new (I’m sure cooler) site.
The post 301 Redirect from Old Site to New appeared first on JDM Labs.