301 redirects and htaccess
POSTED by: on 04/27/2010
Suppose you have a webpage named, for example, oldpage.html and for some reason or other you want to change it to, for example, newpage.html.
The problem is that maybe Google has already indexed oldpage.html and maybe people have already linked to oldpage.html, so if you change the page name all the links to the old name will be broken.
So what to do? The solution is called a 301 redirect, and works as follows:
If the old page is at: http://www.example.com/oldpage.html
and the new page will be at: http://www.example.com/newpage.html
Then put the following in your .htaccess file:
redirect 301 /oldpage.html http://www.example.com/pagefile.html
And presto! Whenever anyone accesses oldpage.html they get newpage.html instead. None of the links are broken and Google is happy.
One technical note, don’t forget the ‘/’ in front of oldpage.html in the .htaccess file, otherwise the redirect won’t work.



