By Jon Burgess
301 Redirect – Redirecting old pages to new pages with an “.htaccess” file
Google wants to see quality content on your pages, so when you are changing your site and are forced to move pages and change their name, you’ll need to use a 301 redirect. A 301 redirect is the preferred practice to preserve your search engine rankings and page rank.
What is a 301 redirect?
The 301 redirect is way to tell the search engine spiders that you have presently moved a file. There are a number of ways to create a 301 redirect; I prefer using the .htaccess file, because it is nice and tidy. You can write the redirect in PHP, ASP, JSP, or ColdFusion, but you’ll end up with all the files still needing to be hosted on your server.
The .htaccess File
- The htaccess file only works on Linux servers that use the Apache Mod-Rewrite.
- The file is really a .txt file, so you can edit it in notepad if needed.
- You must save it with the (.) period in the file.
- Writing the code is simple:
redirect 301 /old/old-page.htm http://www.newsite.com/new-page.htm
*Note, the spacing needs to be exact, and as long as you are in the same site, you can use the relative path of your folders.
- Each additional page that needs to be moved can be added to the next line.
Posting the .htaccess File
The .htaccess file needs to be posted to the main (root) html folder of your site. Sometimes the file may be hidden from view, so if you are using cloaking, make sure you un-cloak your settings.
Immediately test the file. Simply type in all of your old pages URLs into the browser, and make sure they re-direct to the new page. If you see a major error, like the site has blown up, take the .htaccess folder down! Check you syntax for errors.
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.newsite.com/new-page.php” );
Powered by Facebook Comments