homepage Welcome to WebmasterWorld Guest from 54.205.205.47
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Bug in Apache 1.3?
Discrepancy between documentation and actual behaviour
andreasfriedrich




msg:1518626
 9:38 pm on Nov 18, 2002 (gmt 0)

Description

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

 

jeremy goodrich




msg:1518627
 8:35 pm on Nov 21, 2002 (gmt 0)

Great tutorial, as always.

Thanks for the well organized post.

andreasfriedrich




msg:1518628
 9:34 pm on Nov 21, 2002 (gmt 0)

Thanks for noting and taking the time to reply, Jeremy.

Andreas

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved