apache AllowOverride and Options use details
- 2020-05-06 12:07:19
- OfStack
Usually when URL is rewritten using Apache's rewrite module, rewrite rules are written in the.htaccess file. However, in order for apache to read the contents of the.htaccess file properly, the directory in which the.htaccess file resides must be configured. For security reasons, the AllowOverride attribute of the root directory is generally configured to not allow any Override, or
<Directory />
AllowOverride None
</Directory>
When AllowOverride is set to None, the.htaccess file is completely ignored. When this directive is set to All, all directives with the ".htaccess "scope are allowed to appear in the.htaccess file.
For URL rewrite, at least you need to set the directory to
< Directory /myblogroot/>
AllowOverride FileInfo
< /Directory>
2. Enable Options FollowSymLinks and AllowOverride All
in the directory where you want to support url rewirte
Alias /php "c:/web/php/"
<Directory "c:/web/php/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Through http like this: / / localhost: 8080 / php/access, / php/and the subdirectory underneath will support url rewrite
1 AuthConfig allows access to all permission directives, including AuthDBMGroupFile AuthDBMUserFile AuthGroupFile AuthName AuthTypeAuthUserFile and Require
2 FileInfo allows the use of instructions of the file control type. They include AddEncoding AddLanguage AddType DEfaultType ErrorDocument LanguagePriority
3 Indexes allows the use of direction-control type instructions. They include AddDescription AddIcon AddIconByEncoding DefaultIcon HeaderName IndexIgnore ReadmeName
4 Limit allows permission control instructions. They include Allow Deny and Order
5 Options allows the use of instructions that control directory characteristics. They include Options and XBitHack
Options
1 All all the following functions are permitted except MultiViews
MultiViews allows multiple content to be viewed, and if you have a file in your directory called foo.txt, you can ask about it by calling /foo, which is useful for a multilingual site
If there are no index files in this directory, the files in that directory are allowed to be displayed for selection of
4 IncludesNOEXEC permits SSI, but the #exec and #include functions
are not available5 Includes permission SSI
In this directory, the server tracks symbolic links. Note that even if the server tracks the symbolic link, it does not change the pathname used to match the different regions, if in < Local > ; Set within the tag. This option is ignored by
7 SymLinksIfOwnerMatch only tracks links within this site in the directory
8 ExecCGI CGI
is licensed under this directory