I'd read that enabling .htaccess for all directories causes a performance overhead, because all subfolders are also scanned for .htaccess files.
I'd like to only have the .htaccess file read in: /var/www/xgclan.com/public_html and /var/www/xgclan.com/public_html/forum
I've configured the following in my apache2.conf (for /var/www/xgclan.com/public_html)
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/xgclan.com/public_html>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
But this doesn't seem to work.. the sub directories are also read for .htaccess files
I should mention that xgclan.com is a virtualhost. What am I doing wrong?
I was able to prevent subdirectories from being checked for .htaccess files with:
<Directory /var/www/xgclan.com/public_html/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
But this also blocked the .htaccess file in /var/www/xgclan.com/public_html/forum So I tried adding the following rule to allow that specific directory:
<Directory /var/www/xgclan.com/public_html/forum>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
But this doesn't seem to work.
Have you tried adding the Directory section withing the VirtualHost declaration?
What is your error_log output when accessing the host on the browser? Do you get any error as stated in the apache docs?
Ok, so if you want apache to scan just two specific folders out of the whole virtualhost directory for .htaccess files you should specify which ones you want to forbid and allow, something like: