Home Categories Design Tutorials Tutorial

Renaming/moving a page? 301 redirect it!

1.0/5.0 (1 votes total)
Rate:

Michael Bloch


Michael Bloch
Michael Bloch
Team ThinkHost
http://www.thinkhost.com

ThinkHost is an international web hosting company offering reliable and well supported FrontPage, PHP and MySQL hosting services, plus a wide range of related resources for their clients.



Michael Bloch has written 2 articles for WebKnowHow.
View all articles by Michael Bloch...

If you are considering moving a page on your web site into another folder or simply renaming it; there's a couple of important points to consider. The most important issue is that if the page you are moving or renaming has a good search engine ranking already, or may have been bookmarked by your visitors; all your hard work could be lost.

Bearing in mind that search engines can take months to refresh their listings, any visitor clicking on a search engine result may be severely frustrated if they don't arrive on the page on your site. You could always use a custom 404 error page; but this is still an extra hurdle for visitors to jump and the rankings you have built up for the page in question will be lost.

Wouldn't it be great if you could set up your site so it was "smart" enough to know that the page had been renamed or moved and then take the visitor to the correct page? Well, you can!

Enter the 301 redirect

One of the simplest ways to redirect visitors is to put up a blank page with what's known as a "meta-refresh" tag, but, this is frowned upon by many search engines and definitely won't save your rankings, so we won't discuss it any further. If you are currently using meta-refresh tags, it would be wise to consider changing them over to a 301 redirect as it is the most efficient and friendly solution. Search engine spiders and human visitors will be presented with the correct page if the old page is requested - seamlessly.

A 301 redirect is implemented in your .htaccess file.

What is .htaccess ?

.htaccess is a text file that is checked by the web server when a request for a page/item is made by a browser, agent or spider. It contains specific instructions on how to handle specific requests and also plays a role in security.

What's a 301 redirect?

"301" translates to "moved permanently". After the code, the name and location of the moved or renamed page is noted, then there is a space, and then the new location and name of the file.

Implementing a 301

First of all, check with your web host that you can use a 301 redirect - not all web servers will be compatible.

You'll then need to download the .htaccess file from your web site which can be found in the root of your documents directory via ftp (use ASCII mode). If a .htacess file isn't present, create one with Notepad or a similar text editor. Ensure you remember the "." at the beginning of the file name and do not use a tail extension

If there is a .htaccess file already in existence with lines of code present, be very careful not to change any existing code. It's probably wise to create a backup of this file in case you make a mistake.

Scroll down to the end of the current code, miss a line and then create a new line using the following example as a guide.

redirect 301 /current/currentname.htm http://www.you.com/newfolder/newname.htm

That's all there is to it - save and upload back to the document root directory and then test it out by typing the old address into your browser - you should be seamlessly redirected to the new page name/location.

Note: Do not use "http://www" in the first section of the statement - just add the path from the top level of your site to the page. Also ensure that you leave a single space between these elements:

redirect 301 (the directive that the page has permanently moved)

/currentfolder/currentname.htm (the old path and file name)

http://www.you.com/newfolder/newname.htm (new path and file name)

Moving/renaming many pages?

The basic 301 redirect is a great solution for changes to a few pages, but what about dozens of pages or an entire site? A more powerful set of instructions for URL redirects is contained in the Apache mod_rewrite module. Learn more about it here:

http://httpd.apache.org/ docs/misc/rewriteguide.html

This article is copyright (C) 2003 and cannot be reproduced without express written permission from ThinkHost.


Add commentAdd comment (Comments: 0)  

Advertisement

Partners

Related Resources

Other Resources