Search Your Web Hosting PlanCompare Webhosting ProvidersTour Top Web Hosting
Tell a Friend Bookmark and Share
In-depth Web Hosting Directory - Web Hosting Reviews and Consumers Guide

htaccess

.htaccess (hypertext access) is a configuration file used on apache web servers. .htaccess files can be placed in the root directory or other folder on the server. The .htaccess rules then apply to the entire directory it is contained in including all files and sub-directories.

htaccess always needs to have a file name of .htaccess - there should be no name before the dot and no trailing dot with file extension. This makes it a hidden file on UNIX servers although most web hosts will allow you to see this file in the directory listing in FTP

.htaccess files give webmasters the ability to make custom configuration rules.

Some of the most common reasons for using .htaccess:

Cloaking / Hiding Affiliate URL's - If you are using affiliate links on your site then you can easily cloak them by using .htaccess. This means that your users do not know that you are pointing to an external site when they hover over a link as the link will contain your website URL and a custom file name at the end.

Rewriting URLs - If you have a database driven website then it is likely that your URLs will become very long and contain a mix of variables and sessions details. You can cut these down to clean URLs by using .htaccess.

Authentication - You can set security restrictions using .htaccess. This can be used at directory level and you usually need to also create a .htpasswd file as well which is where the usernames and passwords are stored. Website visitors will not have access to this file so it is safe and secure (unless your site is hacked).

htaccess is not the only way to achieve above tasks so it is down to personal preference whether or not you choose that method. htaccess is however regarded as the most flexible way of completing a number of server related tasks.

How to Cloak Affiliate Links with .htaccess

  1. Create an htaccess.txt file on your computer
  2. Open the file in Notepad, Textpad or other text editor
  3. Insert a line like: Redirect /fakefoldername http://www.youraffiliatelink.com.
  4. Where /fakefoldername refers to what your visitors will see when they hover over your link. Replace the URL with your actual affiliate link.
  5. Save htaccess.txt
  6. On your website, change your actual affiliate link to instead link to www.yourdomain.com /fakefoldername using the name you created in step 3.
  7. Upload htaccess.txt to your root directory and rename it to .htaccess - make sure you delete the .txt or it will not work!
  8. Upload your web page with the changed link.
  9. Your links will now be cloaked and well disguised.

You can easily add additional links to your .htaccess file by simply starting a new line for each link.

The above is just one task you can complete in .htaccess - there are plenty more that you can also learn which will give your website the edge.

Back
 Home |  Contact Us |  About Our Web Hosting Directory |  Vote Your Best Host |  Privacy Policy |  Terms of Service |  Site Map