Windows, Apache and .htaccess authentication

Written by Shanx May 26th, 2003

Windows, Apache and .htaccess authentication

Continue reading →
Close

It is quite simple to use .htaccess on Windows. Simple instructions with screenshots here.

Enabling password authentication on Windows using Apache (and here’s a link if you wish to RTFM) given the knowledge that you are busy folks so these are merely quick instructions to get it working on Windows.

Some things to know beforehand:

  1. Path to your Apache server (e.g., c:\apache)
  2. Path to your CONF folder (e.g., c:\apache\conf)
  3. Path to your DOCROOT folder (e.g., c:\apache\htdocs)
  4. Path to the folder you wish to password-protect. In my
    example, lets take a folder called “secure”, so the path to this
    would be “c:\apache\htdocs\secure”. (It could be ABOVE the htdocs
    folder as well, FYI).

Ok, let the show begin:

  1. Open up your httpd.conf. (On my machine this is at
    “c:\apache\conf\httpd.conf”).
  2. Look for the word called “AccessFileName”. I believe there
    should be a line like this:

    AccessFileName .htaccess
    

  3. If you use Windows 2000 or above, then move on to step 4
    (because you can create files like “.htaccess” on your system which
    do not have anything before the dot in the filename. If not, then
    change this line to the following:

    AccessFileName ht.acl .htaccess
    
  4. Then, we need to add the directory to the configuration.
    Instead of rattling on about how to do it, here is a
    screenshot:

    alt="This is what the HTTPD.CONF should look like. " />

    Please note that “/apache” in the directory path means that it
    starts from the root drive on my machine (“c:”). Adjust
    accordingly.

  5. Our httpd.conf is done. Now we need to create the password
    file. Open up a DOS prompt and go to the apache’s BIN directory. In
    my case, it is “c:\apache\bin”. Anyway, again, I think a screenshot
    is more helpful.

    alt="Instructions for creating the password file" />

  6. Now, we need to create the HTACCESS file itself. As per point 3
    above, either create a “.htaccess” or a “ht.acl”, whichever suits
    you fine. I will keep my example to “ht.acl” because this works on
    ALL windows systems if they use Apache 1.12…or above. Here is
    what this looks like.

    c:\apache\htdocs\secure\ht.acl
    

  7. Save the above file into your SECURE folder because it
    represents only that folder context.

READY TO ROLL! (I restarted my Apache, just in case). Here is
what happens when I try to access my folder from the browser:

Posted in Miscellaneous

151 Comments

Tagged with

151 Comments

  1. Walter says:

    Worked perfectly for me with WAMP

Leave a Reply

Miscellaneous

I use the Nokia e61i as my mobile. Instead of my telco’s data plan (which offers me a meagre 1GB per month) I simply prefer to use my home wireless [...]

Continue reading →

View all

Web Tools

If you use Firefox (and if not, what are you waiting for?) you are familiar with useful extensions such as Video Downloader, which allow you to save local copies of [...]

Continue reading →

View all

Databases

This regexp worked for me. SELECT * FROM table WHERE NOT column ~ ( ‘^(‘|| $$[\09\0A\0D\x20-\x7E]|$$|| — ASCII $$[\xC2-\xDF][\x80-\xBF]|$$|| — non-overlong 2-byte $$\xE0[\xA0-\xBF][\x80-\xBF]|$$|| — excluding overlongs $$[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|$$|| — straight 3-byte [...]

Continue reading →

View all

Windows

So you’ve been visited by the much dreaded CRC — Cyclical Redundancy Check error, most likely encountered while copying files between hard disks. On Mac OSX, this will usually appear [...]

Continue reading →

View all

Mac OSX

A simple app ought to do it. Download iRinger. It’s a Windows app. If you’re on Mac, you’ll want to use it within a virtual machine, like Parallels or VMWare [...]

Continue reading →

View all

System Maintenance

I use the Nokia e61i as my mobile. Instead of my telco’s data plan (which offers me a meagre 1GB per month) I simply prefer to use my home wireless [...]

Continue reading →

View all

Wordpress

Among many new exciting features, WordPress 2.6 released the ability to store each and every revision of your posts, like an elaborate update history. Now this can be a pretty [...]

Continue reading →

View all

Audio/Video

Panic, the makers of some fantastic software such as Transmit or Panic, also have the most light-weight audio converter for the Mac OSX platform. It’s called Audion: get it here. [...]

Continue reading →

View all

iPhone

A simple app ought to do it. Download iRinger. It’s a Windows app. If you’re on Mac, you’ll want to use it within a virtual machine, like Parallels or VMWare [...]

Continue reading →

View all