My Web Hosting Manual


Home > .htaccess > Page 2

.htaccess

What is .htaccess? An .htaccess file is a simple ASCII file, which means you may use notepad to create it. It's used in a directory to change the server configuration. It affects the directory where its in AND all directories under it. So placing it in the root affects all directories in your website, but placing it in the directory called images only affects that directory and any under it.

Usually its part of the Apache Web Server, the most common today.

When you buy hosting, your assigned server has some defaults assigned to it. These defaults may or may not work with your idea of perfect. Thats where the .htaccess file comes into play. It's a powerful configuration file, using it wrong may open holes in security, but using right may turn on or off features in your webserver.

Some of the most common features you can do with .htaccess are change your 404 file (the file you see when no page is found), allowing or disallowing access to your site, making odd URLs look better, hotlink prevention and many more. Some may get very complex, others are simple to make.

How do I create an .htaccess file? To create it, open notepad, and save the empty file as .htaccess or you may have to save it as "htaccess.txt". You will have to remove the .txt from the file and add a period in front of it such as ".htaccess". If your operating system (your windows) doesnt let you thats fine, we can rename it later in your FTP program or once its uploaded.

Once done creating the file, open your FTP program. Login to your hosting account and upload the htaccess file into the desired folder (usually its your root folder). Please upload it in text or ASCII mode. Binary won't work.

The .htaccess is a configuration or reconfiguration file, so you have to be careful on how your manage it. One good thing is that if you upload it wrong or type something wrong in it and your server "breaks" you can just rename it or delete it and everything works again... But be careful anyway.

Here is a list of the most common usage of .htaccess:



|< < 1 2
How to Block Bots, Site Rippers and Offline Browsers
Save bandwidth, protect your e-mail, protect your site, dont get ripped. Use your .htaccess to protect yourself.

How To Prevent Hot Linking Using .htaccess
.htacces has a simple way to not only block hotlinking, but show them different content than they were expecting.

Set Your Server Time To Match Your Own
Once you find your perfect host turns out its located in Europe and you live in the US. Your server time would be off by many hours. Fix it!

Block Users From Accessing Your Site By Their IP Address
Block visitors based on their IP address. Or deny everyone and just allow yourself access for maximmum protection.

|< < 1 2







Top Hosting
  - Host Gator
  - Host Monster
  - Blue Host
  - Easy CGI
  - Lunar Pages
       
All content has been created by Juan Carlos Gorospe. These are my opinions and experiences.
Copyright © 2008, Juan Carlos Gorospe. All Rights Reserved.