Forum Moderators: phranque
Contrary to this claim in Apacheīs documentation [httpd.apache.org]:
<Files> and Options:Apache won't check for it, but using an Options directive inside a <Files> section has no effect.
Options directives inside <Files> sections do have an effect.
How To Reproduce This Behaviour
Modify your httpd.conf to contain:
<Files index.html>
Options -FollowSymLinks
</Files>
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options",
# "FileInfo", "AuthConfig", and "Limit"
#
AllowOverride All
#
</Directory>
Put a .htaccess file with the following content in a directory:
RewriteEngine On
RewriteRule index.aaron index.html
Request /index.aaron. This will result in an error message like this one:
Options FollowSymLinks or SymLinksIfOwnerMatch is off
which implies that RewriteRule directive is forbidden
Note that we get this error message even though we requested /index.aaron not /index.html. As you can see from the rewrite log rewriting does take place. With the new URL mod_rewrite initiates a sub request to /index.html. Now the <File> section applies and FollowSymLinks privileged are revoked.
strip per-dir prefix: /var/www/html/index.aaron -> index.aaron
applying pattern 'index.aaron' to uri 'index.aaron'
rewrite index.aaron -> index.html
add per-dir prefix: index.html -> /var/www/html/index.html
strip document_root prefix: /var/www/html/index.html -> /index.html
internal redirect with /index.html [INTERNAL REDIRECT]
Solution
Donīt use Options in <Files> sections if it causes problems ;)
Setting Options FollowSymLinks anywhere in a Directory context wonīt help since <Files> sections are evaluated after <Directory> sections.
Andreas