According to the W3.org resource page, a 301 redirect command means: “The requested resource has been assigned a new permanent URL and any future references to this resource SHOULD use one of the returned URLs.” Simply inferring that the site has moved and the user will now be forwarded to the domain indicated within the redirect.
Tricky situations where 301 permanent redirect can help
- Moving and renaming particular files: If you’re considering moving or renaming files on your website, which has been indexed and ranked well by the search engines, you run not just the risk of losing a lot of traffic but also all the hard work you put in. This may even leave the visitors to your site to follow a search engine link with the dreaded “Error 404 – File not found. “ Enter the 301 redirect and say goodbye to all your worries.
- Have moved to new domain: If you’ve moved a site to a new domain and you want your normal traffic to follow, a 301 permanent redirect needs to be employed.
- Switching sites from .nets to .com, etc.: To preserve your rank, you will want to inform others who link to you of your change of address. Once your new site is live, you may wish to place a permanent redirect (using a “301” code in HTTP headers) on your old site to inform visitors and search engines that your site has moved.“ Doing so not only informs any site visitors, but also informs search engines (except for Yahoo) that the site has moved.
- Multiple domains pointing to specific pages of your main domain: If additional domain names aren’t redirected properly, all of your other sites risk getting banned in the search engines. Search engines are sensitive to duplicate content, using a 301 redirect in a situation like this can save your site from this type of penalty.
Create .htaccess file:
1. Download the .htaccess file in the root directory where all your web pages are stored (root directory). If there is a .htaccess file already existing with lines of code present, scroll down past all the existing code, leave a line space, and then create a new line that follows this example:
Case 1: Redirect a page
redirect 301 /test.html http://www.abc.com/new.html
Case 2: Redirect entire site
redirect 301 / http://www.xyz.com
Save the file, upload it back into your web, and test it.
Search Engines & 301 Permanent Redirect
- The 301 redirect is the safest way to preserve your rankings.
- In the next update, the old file name and path *should* be dropped and replaced with the new one.
- If you’re changing domain names and using a 301 redirect, you’ll need to leave the old domain name and files in place for a few weeks to give the major search engines time to catch up on to the changes.
- Once you deactivate the old domain, any search engine kudos you’ve built up through those links will be gone.
- 301 redirect is search engine friendly. The 302 meta refresh redirect can also be used, but this technique is often used by spammers to trick search engines and should be avoided, therefore.
- Search engine spammers create a page that is optimized for certain keywords and phrases – without usually having any real content. Some search engines then pick up the page, but when a visitor clicks on the search engine entry, they are redirected to another site, which is often unrelated.
The simple redirect command above is all you need for basic redirects, but if you ever find yourself needing to redirect in a way that you can’t do with the redirect command, be sure to look into mod rewrite.