Wednesday, January 16, 2013

How To Create a 301 Redirect within Your .HTAccess File

If you are considering moving your existing website to an entirely new domain name, one of the fastest and most efficient ways to do it would be by creating a simple 301 redirect in the .htaccess file of your existing web server root.

What Is A 301 Redirect?


The code “301” indicates that the file has been moved permanently. Whether a file name has to be changed or pages have to be moved permanently to a new location, it is one of the best options to ensure that the transition is seamless. Most importantly, by using 301 redirects, the search engine rankings of a website are not impacted. Google and other search engines automatically update their indexes to reflect the new domain name thus helping a website maintain its existing ranking.

How to Create a 301 Redirect:


The whole process is relatively simple and can be completed in about 15 to 30 minutes.

1. Create the same directory structure on the new domain
It is important to maintain the same hierarchy of files and directories as the old domain. The 301 redirect will not work as intended if there is a change in the new file structure or if certain files are misplaced on the new domain. As a precautionary measure for websites with a lot of content, it is advisable to set up a noindex, nofollow robots.text file in order to prevent search engines from indexing the second domain and labeling it as duplicate content. If the website is fairly simple and the transition can be completed quickly, the robots.text file is not necessary.

2. Access the .htaccess file on the old domain

In the root directory of the old domain, locate the. htaccess file. If there is no such file, an htaccess file can be created with the help of a simple text editor such as notepad or SimpleText. The newly created .htaccess file needs to be saved with the exact name in ASCII mode, not binary format.

3. Write a simple line of code in the .htaccess file
Place the following code in the file: redirect 301 / http://www.newdomainname.com/

Note that there is a space between 301 and the forward slash. Use the new domain name of the website in place of the URL above. Ensure that the file is saved.

4. Test the 301 redirect
Check if the 301 redirect is working accurately as intended by visiting some of the old domain pages. These should automatically point to the new domain name.


About the Author

Lyndsi Decker is a tech blogger currently looking into hosting services. To learn more about a hosting reseller click here. In her spare time she can be found blogging or spending time outdoors with her dog.



No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
 
BLOG DESIGN BY DESIGNER BLOGS