.htaccess
I have created a .htaccess file and placed it in the root of /var/www/htdocs/travels dir which is the directory I would like to protect, and I would like to disable dir listing. .htaccess file:
Options -Indexes AuthUserFile /.htpasswd AuthName "travel" AuthType Basic AuthUserFile /var/www/htdocs/travels Require valid-user After this I have also created a .htpasswd file in the root of my system with the user name of travels using the command = htpasswd -c /.htpasswd travels It does not seem to work, do I need to update anything in my httpd.config file in order for apache to pick up .htaccess? or how can I get this going? p.s. i am using slackware 9 thanks |
The command you have used:
command = htpasswd -c /.htpasswd travelsWould be put in the / dir not in /var/www/htdocs/travels |
Quote:
Example: Options -Indexes AuthUserFile /var/www/htdocs/travels/.htaccess AuthName "travel" AuthType Basic Require valid-user |
After reading some documentation on .htaccess it was stated that the .htpasswd file should be created in a directory outside the /var/www/htdocs and the .htaccess file should point to the location of the .htpasswd due to security reasons, that is why I have created the .htpasswd on the / of the system.
Is this not the case should both .htaccess and .htpasswd files be in the dir that I am protecting? |
To clarify:
file /var/www/htdocs/travels/.htaccess Code:
Options -Indexes Code:
username:crypted-passwd |
Thanks ill give that a go
|
I'm still not understanding why your specifying the .htaccess file with two locations for AuthUserFile ?? You should only really need one pointing to the actual location of the .htpasswd file.
|
Sorry that was my mistake, i think all the is left is to restart my apache server but when running the command kill -HUP (pid number of httpd) i am not completely sure this is restarting thou as i am getting no change and the pid number is always the same when i check. After reading through the documentation of restarting the server it states the following command
kill -HUP /usr/local/apache/logs/httpd.pid there is no such location on my machine or no such file. How can i restart it and know that it has restarted? |
Quote:
But if you already have the .htaccess directive in the httpd.conf file, there is no need to restart it. Only if you make direct changes to the file itself. If you already had it setup, then the .htaccess and .htpasswd is already in affect when you set those up. |
Sorry I meant to take the first one out - I forgot when I copied and pasted.
|
Quote:
I'm sorry.. in a good mood.. its raining.. I love the rain.. :) |
This i still not working, i am trying to check the directive in the httpd.conf but i am not sure what i am looking for.
What command do i need to set? |
The following commands are set up in my httpd.conf file
AccessFileName .htaccess |
Make sure you have these in your httpd.conf file:
Code:
# This to look for filename to access control information |
Here is the total directive set in httpd.conf
<Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory "/var/www/htdocs"> AllowOverride None Order allow,deny Allow from all </Directory> <IfModule mod_userdir.c> UserDir public_html </IfModule> IncludesNoExec <IfModule mod_dir.c> DirectoryIndex index.html </IfModule> AccessFileName .htaccess <Files ~ "^\.ht"> Order allow,deny Deny from all Satisfy All </Files> |
All times are GMT -5. The time now is 11:26 AM. |