更新 - 更清楚地了解我遇到的 mod_rewrite 失败。在 Apache 中,我在配置文件中有以下设置:
LoadModule rewrite_module modules/mod_rewrite.so
DocumentRoot "C:/mywebdev/apache/www"
RewriteEngine On
Include conf/extra/httpd-vhosts.conf
<Directory "C:/mywebdev/apache/www">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from All
</Directory>
我的虚拟主机配置中有以下内容
<Directory "C:/mywebdev/apache/www/test">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from All
</Directory>
<Directory "C:/mywebdev/apache/www/test/.htaccess">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from All
</Directory>
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot C:/mywebdev/apache/www/test
ServerName www.test.me
ServerAlias test.me *.test.me
LoadModule rewrite_module modules/mod_rewrite.so
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/library/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</VirtualHost>
在 .htaccess 文件中我有这个:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/library/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
我知道这是矫枉过正,但这只是为了表明无论我做什么它都不起作用。我检查了 mod_rewrite.so 是否在模块文件夹中并且它在那里。该模块不适用于此规则或我尝试使用的任何其他 mod_rewrite 规则。从我读过的内容来看,这应该可以工作。提前感谢您的帮助。