• 0

.htaccess on windows ?


Question

My website runs on a Linux host and I can password protect folders with .htaccess and .htpassword.

My question . . . is this possible on a server running Windows, my server runs PHP-Dev, could someone tell me how to set up a password protected folder, so that I can build an admin section. :unsure:

Kind regards

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0
Find the line in http.conf that labels the reference to .htaccess, change it to something like win.htaccess, and then it can be used in windows.

Ok, thats makes sense Hypercube, but . . .

My host that runs Linux has a control panel with an option in it to protect a folder, this in turn creates the .htaccess and .htpassword files for you.

I can change the http.conf but how do I create a .htaccess and .htpassword file and what do I put in them for a password protected folder.

Are they just text file named .htaccess and .htpassword, please explain how I create them ?

also do I have to name them win.htaccess and win.htpassword or keep the same names as Linux .htaccess and .htpassword ?

All help is greatly appreciated. :happy:

Kind regards

Link to comment
Share on other sites

  • 0

I am running apache/mysql/php on a windows machine with password protected folders just fine. The files are still called .htaccess even though they are on a windows machine. I have it authenticating out of a mysql database so i am also using a mod_auth_mysql for win32 (pain in the crapper to find). Im not sure if this would work for you because of your server set up or not but if you would like any more information just let me know.

Link to comment
Share on other sites

  • 0

I am running Apache/2.0.44 (Win32) with PHP/4.3.2-RC1 and MySQL 4.0.12. I noticed a bug in the COM support of php in 4.3.1which is the only reason im currently running the rc1 of 4.3.2 (its fixed in this release). As i noted earlier, i am also using a module called mod_auth_mysql which handles the securing of directories and authentication to the mysql database.

mod_auth_mysql info:

# Win32 port by: Guenter Knauf <info@gknw.de>

# Home: http://www.gknw.de/development/apache/

I've been in contact with this developer quite a bit recently because his version of the module doesnt appear to be thread safe and it likes to crash under really heavy loads. Hes been most helpful and is currently working on a newer version to fix this.

Hmm..what else.. ah ya, the .htaccess files.. If you check out the mod_auth_mysql i mentioned above he gives examples of what your .htaccess needs to have in it and what lines you need to add to your httpd.conf but i'll mention it here as well.

.htaccess:

AuthName "MySQL Secured Place"

AuthType Basic

require valid-user

AuthMySQLHost localhost

AuthMySQLDB webauth

AuthMySQLUser root

AuthMySQLPassword test

AuthMySQLUserTable user_pwd

AuthMySQLNameField name

AuthMySQLPasswordField pass

AuthMySQLGroupTable user_grp

AuthMySQLGroupField group

AuthMySQLCryptedPasswords Off

httpd.conf:

LoadModule mysql_auth_module modules/mod_auth_mysql.so

Of course all of the fields in the .htaccess are not required. Anything mentioning "group" is only used for group authentication (obviously). I included it because i happen to be using group authentication as well as username/password. Other than the crashing (which is very rare on my system) the module works very well and is quite handy. I had quite a hard time finding it to begin with and i am not about to try to find another one.

I assume you have apache/mysql/php set up already since you said you are currently running it so im not really going to go into much detail there. Let me know if you have any other questions.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.