Happy Valentines Day! Here’s my special gift to you:
About The 301 Redirect - A How To Tutorial
If you have decided to move a whole website, or move a whole directory or folder, or just move a page, then a 301 redirect is the way to do it.
Or perhaps you’ve renamed a page but don’t want to lose the traffic from people who’ve bookmarked the old page name, or worse, loose search engine listings and traffic pointing to the old named page. The answer, again, is…
The only “Google approved redirect“, - a 301 redirect. For the purposes of this tutorial, we will only be discussing 301 redirects using the .htaccess file method for use on LINUX systems running on Apache servers. If you’re not sure of what type server your hosting package offers, contact your hosting company. Here are various other non-htaccess methods of implementing a 301 redirect, such as Coldfusion, ASP, ASP.net, PHP, JSP (Java), CGI PERL, or Ruby On Rails (ROR).
What is a .htaccess file?
A .htaccess file is: a file typically located in the root (main) directory of your website. Your web server checks this file when a visitor or search engine spider requests a web page from your website. The .htaccess file contains specific instructions for how to handle certain types of requests, including security, redirection issues, missing pages and how to handle specific types of errors.
What is a 301 redirect?
301 = PERMANENT. (This doesn’t mean permanent as in forever eternity, but permanent as in until you decide to change it again.)
The code “301″ is used for and is interpreted by the Apache server to notify the browser (viewer) or search engine spider that the page(s) has “moved permanently”. The script tells the server the URL of the missing or renamed page(s), then tells the server the new location where to go to.
How do I install a 301 redirect?
Firstly, download the .htaccess file from the root directory of your website. If there is no .htaccess file there, you can simply create one with Notepad or a similar ASCII text editor. Be sure when you name the file that you put the “.” at the beginning of the file name. This file has no suffix for file type - just call it: .htaccess If there is a .htaccess file already in your root directory, and it already contains lines of code, be sure NOT to change any existing code unless you are VERY familiar with the functions of the code.
How To Do a 301 Redirect for Specific Pages
Leave a line or two of space after any current existing code, then create a new line of code EXACTLY like this (using your domain and file names where applicable):
redirect 301 /oldFolder/oldPage.htm http://www.yoursite.com/newPage.htm
It’s that easy. Save the file, and upload it back into the root folder of your server to test it out. You can do so by typing in the OLD address of the page you’ve changed/moved/removed. You should immediately be brought to the new page.
NOTE: Make sure NOT to add “http://www.yourdomain.com” to the FIRST part of the code (after ‘301′) - just input the path from the root level of your site to the page name.
Also, looking closely at the example above, note to be sure that you leave a single space between the main elements:
redirect 301 (the instruction that the page has moved)
/oldFolder/oldPage.htm (the original folder path and file name)
http://www.yoursite.com/newPage.htm (new path and file name)
Redirecting entire whole folders and websites with 301 redirect
No Comments »
No comments yet.