Move a site or a folder? What about your rankings?
January 12, 2009
A .htaccess file is one of the easiest ways to redirect your existing traffic to other pages. There are a variety of reasons you may want to do this. For Example:
- Changed folder names
- Moved a site
- Migrated from plain html to a CMS
.htaccess files allow you to customize the way that your site or a specific directory on your site behaves. For example, if you place an .htaccess file in your root directory, it will affect your entire site (www.coolexample.com). If you place it in a /content directory, it will only affect that directory (www.coolexample.com/content). .htaccess only works on our Linux hosting servers.
Using an .htaccess file, you can:
* Customize the Error pages for your site.
* Protect your site with a password.
* Enable server-side includes.
* Deny access to your site based on IP.
* Change your default directory page (index.html).
* Redirect visitors to another page.
* Prevent directory listing.
.htaccess files are a simple ASCII text file with the name .htaccess. It is not an extension like .html or .txt. The entire file name is .htaccess.
How? Add one of the following line to your .htaccess file, but don’t add “http://www” to the first part:
redirect 301 /oldfolder/oldpage.htm http://www.yourdomain.com/newfolder/newpage.htm
redirect 301 /oldfolder/oldpage.htm http://www.yourdomain.com/newpage.php
redirect 301 /index.html http://www.yourdomain.com/index.html
To redirect ALL files on your domain:
redirectMatch 301 ^(.*)$ http://www.domain.com
For more information on how to set up .htaccess files, visit Apache’s Web site.
Comments
Got something to say?
You must be logged in to post a comment.



