LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   htaccess again (https://www.linuxquestions.org/questions/linux-newbie-8/htaccess-again-111151/)

spank 11-01-2003 12:40 PM

htaccess again
 
Do I have to edit httpd.conf in order to get htaccess to work ? Can smdy give me an example of a .htaccess file that I can put in a subdirectory and get it restricted from other users. Make it accesible only with password. THX

tgflynn 11-01-2003 12:45 PM

Re: htaccess again
 
Quote:

Originally posted by spank
Do I have to edit httpd.conf in order to get htaccess to work ?



It depends on what's in the httpd.conf file. htaccess configuration can be deactivated, limited, or the filename changed, all from httpd.conf. But on many default installs it will be set up to work out of the box.

Quote:

Can smdy give me an example of a .htaccess file that I can put in a subdirectory and get it restricted from other users. Make it accesible only with password. THX
Here's one:

AuthType Basic
AuthName "Whatever"
AuthUserFile /home/smdy/passwd
Require valid-user

Note that the file /home/smdy/passwd must be created with the htpasswd command. Also you should make sure that it's in a place that is not served by the Web server.

Tim

spank 11-02-2003 02:50 AM

Can you please tell me what directives form httpd.conf have to be edited in order to get .htaccess files to work ?

tgflynn 11-02-2003 07:48 AM

You first need the directive

AccessFileName .htaccess

directive for user access directories :

AllowOverride FileInfo AuthConfig Limit Options

You should look at the Apache documentation to see what these do and what other overrides can be allowed.

Finally, my configuration contains the following to prevent users from downloading the .htaccess files:


<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>



Tim

bleah-man 11-02-2003 08:56 AM

Remember to:

chmod 755 your password and .htaccess file if you are running RH9 distro with apache 2.x - it's squirley on the permissions for some reason had me kicking myself for weeks on end!

Bleah-Man


All times are GMT -5. The time now is 12:01 PM.