Forum Moderators: phranque

Message Too Old, No Replies

Restrict .htaccess usage?

allow .htaccess in base dir but nowhere else.

         

Taurus_II

9:22 am on Feb 12, 2004 (gmt 0)

10+ Year Member



Firstly, in the last few days I have read postings on this forum, back to 2001. That's allowed me to open the few pages I want to the big bad world. Cheers.

Ok, the matter at hand. Whilst trying to make my mind up whethet to put rules in .htaccess ot httpd.conf;

<Directory />
Options -All -Multiviews
AllowOverride None

<IfModule mod_access.c>
Order deny,allow
Deny from all
</IfModule>

</Directory>

I don't want a .htaccess file anywhere but the base directory, /var/www/html. So how do I now allow this please? I ask because I thought AllowOveride affects sub-directories too. Maybe a <Files > instead of <Directory > would work?

jdMorgan

6:30 pm on Feb 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Taurus_II,

You might look into using DirectoryMatch, and specifying that subdirectories other than "/" have AllowOverride FileInfo disabled. Another way to do it might be to deny setting Options +FollowSymLinks in those subdirectories by denying AllowOverride Options. Either setting will disable mod_rewrite.

I've never tried DirectoryMatch for this purpose, but it might work.

Jim