Open the Apache mod_rewrite module sample code
- 2020-05-09 19:45:10
- OfStack
Enable the mod_rewrite module
Find it in the httpd.conf file in the conf directory
LoadModule rewrite_module modules/mod_rewrite.so
Get rid of the # in front of this 1 line.
2. Enable Options FollowSymLinks and AllowOverride All in directories where you want to support url rewirte
Alias /php "c:/web/php/"
Through http like this: / / localhost: 8080 / php/access, / php/and the subdirectory underneath will support url rewrite.
Postscript: php100 com
Many articles on the Internet do not mention using Options FollowSymLinks, because it is available in httpd.conf
So if your site is configured to be accessed via http://localhost:8080/, you won't notice the effect of Options FollowSymLinks, just change AllowOverride None to AllowOverride All. But I'm used to in the unit configured to http: / / localhost: 8080 / php /, forget to add Options Indexes FollowSymLinks would have failed, is displayed
Forbidden
You don't have permission to access /php/f2blog/ on this server.
A mistake like that. The reason was later found in the apache documentation
Note: To enable the rewriting engine for per-directory configuration files you need to set ``RewriteEngine On'' in these files and ``Options FollowSymLinks'' must be enabled. If your administrator has disabled override of FollowSymLinks for a user's directory, then you cannot use the rewriting engine. This restriction is needed for security reasons.
Actually mod_rewrite is for directories, so it is not necessary to change all AllowOverride None in httpd.conf to AllowOverride All, and Options as well.
BTW: it seems that the first thing to look at is the documentation provided by the program, but I have read almost all the documentation of tomcat5.0.28, and I have not seen whether the service can be successfully installed on windows through service.bat. I have seen many people ask N the same question as me, but I have no answer. Well, I certainly know that the tomcat service can be successfully installed through tomcatxx.exe, so it seems that this is the only way.
Find it in the httpd.conf file in the conf directory
LoadModule rewrite_module modules/mod_rewrite.so
Get rid of the # in front of this 1 line.
2. Enable Options FollowSymLinks and AllowOverride All in directories 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.
Postscript: php100 com
Many articles on the Internet do not mention using Options FollowSymLinks, because it is available in httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>
So if your site is configured to be accessed via http://localhost:8080/, you won't notice the effect of Options FollowSymLinks, just change AllowOverride None to AllowOverride All. But I'm used to in the unit configured to http: / / localhost: 8080 / php /, forget to add Options Indexes FollowSymLinks would have failed, is displayed
Forbidden
You don't have permission to access /php/f2blog/ on this server.
A mistake like that. The reason was later found in the apache documentation
Note: To enable the rewriting engine for per-directory configuration files you need to set ``RewriteEngine On'' in these files and ``Options FollowSymLinks'' must be enabled. If your administrator has disabled override of FollowSymLinks for a user's directory, then you cannot use the rewriting engine. This restriction is needed for security reasons.
Actually mod_rewrite is for directories, so it is not necessary to change all AllowOverride None in httpd.conf to AllowOverride All, and Options as well.
BTW: it seems that the first thing to look at is the documentation provided by the program, but I have read almost all the documentation of tomcat5.0.28, and I have not seen whether the service can be successfully installed on windows through service.bat. I have seen many people ask N the same question as me, but I have no answer. Well, I certainly know that the tomcat service can be successfully installed through tomcatxx.exe, so it seems that this is the only way.