LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   .htaccess vrs <Directory> (http://www.linuxquestions.org/questions/linux-software-2/htaccess-vrs-directory-516879/)

vous 01-06-2007 08:46 AM

.htaccess vrs <Directory>
 
In my Apache httpd.conf file I see this by default:

>>>>>>
# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

<<<<<<

Which is a great security measure BUT I am not sure what is the best way to override this (for my public html dir), without killing the initial intended functionality of protecting the rest of my file system.

In the Apache docs I see two options:

1) .htaccess

2) Or creating a <Directory> entry in my httpd.conf

I am not sure which one should I take?

Any ideas??!

raskin 01-06-2007 10:42 AM

Second, because first doesn't work with AllowOverrides None.

vous 01-06-2007 12:12 PM

OK, but how safe it?

Will it override this security entry:

>>>>>>
# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

<<<<<<

raskin 01-06-2007 12:28 PM

I do nothing special, and yet I get a 403 while trying to access .htaccess from 127.0.0.1 .

It will override - locally - settings for higher directory. And what do you understand under 'safe'? To have httpd entirely safe you need to shut it down... I guess it doesn't give .ht* files to anyone by default. But it will give HTML pages. It will also give results of running cgi scripts, but - if handlers are properly configured - not scripts themselves.

billymayday 01-06-2007 01:04 PM

Apache only recommend using htaccess where you can't give access to the config file - for example, an ISP hosting sites will give clients htaccess abilities because you obviously can't let them edit httpd.conf


All times are GMT -5. The time now is 10:26 AM.