Restrict Access Using Htaccess on Windows

Filed in: Web Development — February 1st, 2005

I wrote a simple web application for stock management to be used inside the company(by only a staff). I got a request to implement password protection to the system.

I do not want to modify database and modify the codes(and I am lazy :P ). So, the fastest way is to use .htaccess file to restrict access to the web directory.

However, Microsoft Windows does not support filename starts with a ‘dot’. How do we implement the .htaccess?!

I found a very good tutorial(with DETAILS explaination) for Apache .htaccess Authentication.

After reading the tutorial, the web system implemented password protection in just 5 minutes! :wink:

Thought:
Though Apache web server configuration file is plain text file, but it is VERY powerful if you dig it down. :)

Like this post? Please share:

Follow @liewcf on Twitter; Join Facebook page; Subscribe to free newsletter for updates like this article..

  • http://www.uzyn.com/ uzyn

    I have been writing .htaccess on Windows XP Notepad.

    In fact, I’ve just tested and it still works.

  • http://www.uzyn.com uzyn

    I have been writing .htaccess on Windows XP Notepad.

    In fact, I’ve just tested and it still works.

  • http://www.liewcf.com/ LcF

    According to the link in the post, the author said Windows XP support filename with “dot” infront. However, it does not work for me.

  • http://www.liewcf.com LcF

    According to the link in the post, the author said Windows XP support filename with “dot” infront. However, it does not work for me.

  • http://www.uzyn.com/ uzyn

    Did you get system error? Hmm.Strange. Normally what I do is that after saving from a notepad, it would become .htaccess.txt

    I would then rename it to .htaccess manually.

  • http://www.uzyn.com uzyn

    Did you get system error? Hmm.Strange. Normally what I do is that after saving from a notepad, it would become .htaccess.txt

    I would then rename it to .htaccess manually.

  • http://farking.spunge.org/blog farking

    the trick is choose “All files in the” file type or save as with the quote “.htaccess”

  • http://farking.spunge.org/blog farking

    the trick is choose “All files in the” file type or save as with the quote “.htaccess”

  • http://www.liewcf.com/ LcF

    Thanks for the tip, farking! Found that we cannot rename a file to .htaccess, but “Save as…” works. :)

  • http://www.liewcf.com LcF

    Thanks for the tip, farking! Found that we cannot rename a file to .htaccess, but “Save as…” works. :)

  • Pingback: Sniptools

t