user734861 user734861 - 1 year ago 246
Apache Configuration Question

What does RewriteOptions inherit in htaccess file do?

While modifying some configuration in

file, I found the directive
RewriteOptions inherit
already present there. I am confused about what it does, and whether to delete that line and start as new, or append my configuration to the existing data.

What does this directive do, and is there any side effects by deleting the line?

Sidenote: I want to use
to select the default index file.

Answer Source

The Inherit option means that any rules in htaccess files in a parent directory is "inherited":

Inherit - This forces the current configuration to inherit the configuration of the parent. In per-virtual-server context, this means that the maps, conditions and rules of the main server are inherited. In per-directory context this means that conditions and rules of the parent directory's .htaccess configuration or <Directory> sections are inherited. The inherited rules are virtually copied to the section where this directive is being used. If used in combination with local rules, the inherited rules are copied behind the local rules. The position of this directive - below or above of local rules - has no influence on this behavior. If local rules forced the rewriting to stop, the inherited rules won't be processed.

Note: Rules inherited from the parent scope are applied after rules specified in the child scope.

Normally, if you have an .htaccess file in a particular sub-directory, any rules in a parent directory are superseded and won't be applied. See How directives are applied in the .htaccess files Apache HTTP Server Tutorial.:

The configuration directives found in a .htaccess file are applied to the directory in which the .htaccess file is found, and to all subdirectories thereof. However, it is important to also remember that there may have been .htaccess files in directories higher up. Directives are applied in the order that they are found. Therefore, a .htaccess file in a particular directory may override directives found in .htaccess files found higher up in the directory tree. And those, in turn, may have overridden directives found yet higher up, or in the main server configuration file itself.

With the RewriteOptions inherit option, any rewrite rules in a parent directory are essentially appended to the end of any rules in the sub directory. Apache 2.4 has an additional option of appending them before or after the rules in the sub directory. The directive will only affect mod_rewrite and rewrite rules. The DirectoryIndex directive will be unaffected. If this htaccess file is already in your document root, then you can remove it as there is not "parent" htaccess file.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download