Protecting your pages with htaccess

.htaccess (hypertext access) is the default name for directory-level configuration files. A .htaccess file is placed in a directory, and it is applied to that directory, and all subdirectories. It provides the ability to customize configuration for requests to the particular directory.

Thus, .htaccess files are often used to for security restrictions on a particular directory. The .htaccess file is often accompanied by an .htpasswd file which stores valid usernames and its passwords. The steps for this security methods are:

  1. Creating the password file. First create a simple text file that will store your username and password. It will be separated by a colon (:). The password must be encrypted. You can use many free web-based tools that will encrypt the password, like 4WebHelp’s tool. Save the username and password generated to a file called .htpasswd using text editor like notepad.
  2. Upload this file to your website outside the Web root of your site, so that public are not able to view the file. For example, place it above your public_html folder.
  3. Create a file with the name .htaccess, which will use the .htpasswd to protect your page(s) or website. Put the following code in the file:AuthUserFile /full/path/to/.htpasswd
    AuthType Basic
    AuthName “My Secret Folder”
    Require valid-user

    /full/path/to/.htpasswd must be the full path to the .htpasswd file that you uploaded earlier – for example, /home/username/.htpasswd. (If you’re not sure the full path to your website, ask your Web hosting company.) 

 

Share and bookmark:
  • RSS
  • Twitter
  • StumbleUpon
  • Technorati
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Reddit
  • Propeller
  • Google Bookmarks

Related posts:

  1. Redirect using htaccess
  2. How to install wordpress
  3. Php download script
  4. What is SSI?
  5. Dealing with Referer spam

0 comment(s)

  • Any feedback from you?

    This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.

Jun 25, 2008 by admin

WEB HOSTING COUPON CODES:

HostGator 20% OFF first order - Code: AUTUMN

HostGator 1-cent web hosting - Code: hgc25

HostGator 20% OFF initial order - Code: GREEN

GreenGeeks 10% OFF - Code: 10off

Super Green Hosting HostGator GreenGeeks HostPapa green web hosting ad