Understanding Apache htaccess

Page 3 - Options

Skip to navigation

The Apache directive, RewriteOptions, is used when the possibility of an infinite loop is unavoidable from the rewrite. It's option is to use maxdirect=x, where x is an integer value to specify the number of redirects allowed by htaccess before it will stop. The default for this is to allow 10 redirects before it steps in and stops the redirect from happening. The problem with using this directive though is that it will not be available on all servers as it was introduced with Apache 2.0.45 and Apache 1.3.28. Another option is to use inherit in place of maxredirect=x so that the previous directories' .htaccess is used in addition to whatever rules appear in this configuration structure.

RewriteOptions maxredirect=5

Options also exists as a directive in Apache, though this differs significantly from the RewriteOptions directive. The Options directive can be used with a number of different controls in order to manipulate the ability to have symlinks, etc.

All
This is the default setting, and enables all the options except for MultiViews.
ExecCGI
Allows the execution of CGI scripts.
FollowSymLinks
Any symbolic links used in the folder, or subfolders, to be followed to their target. This though, does not change the path to that of the target.
Includes
Server-side includes are permitted.
IncludesNOEXEC
Server-side includes are permitted, but the #exec command and #exec CGI are disabled. It is still possible to #include virtual CGI scripts from ScriptAliase'd directories.
Indexes
If a URL which maps to a directory is requested, and the there is no DirectoryIndex (e.g., index.php) in that directory, then the server will return a formatted listing of the directory.
MultiViews
Content negotiated MultiViews are allowed.
SymLinksIfOwnerMatch
This will work in more or less the same fashion as FollowSymLinks with the exception that it will only allow the link to be followed when the target is owned by the same user as the link that sent it.

Preceding one of these by a - will disable them from the configuration, and a + will enable them. The following example shows how to allow the following of symlinks on the server, but disallow indexes.

RewriteEngine on
Options +FollowSymLinks -Indexes