我只想更改功能。
mod_rewrite是根据PHP启用的。我尝试将垃圾放入.htaccess文件中,这给了我500个错误,所以我猜这也有效。
我的 vhosts文件:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/htdocs"
ServerName test2
DirectoryIndex index.php
<Directory "C:/htdocs">
AllowOverride All
Allow from All
</Directory>
RewriteLog "C:/xampp/apache/logs/rewrite.log"
RewriteLogLevel 9
</VirtualHost>
我的 .htaccess 文件
的内容Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?feature/([a-zA-Z0-9]+)$ /feature.php?id=$1 [L,QSA]
</IfModule>
和 rewrite.log的内容
127.0.0.1-- [19/10月/2012:12:23:17 0100] [test2/sid#2006540] [RID#66156B0/direction](3)[3)[Perdir c:/htdocs/]-dir前缀:c:/htdocs/feature.php-> feature.php
127.0.0.1--- [19/10月/2012:12:23:17 0100] [test2/sid#2006540] [RID#66156b0/dirind](3)[Perdir c:/htdocs/]应用模式'^/]? 127.0.0.1--- [19/10月/2012:12:23:17 0100] [test2/sid#2006540] [RID#66156b0/dirind](1)[Perdir c:/htdocs/]通过C:/htdocs/feature.php
riiiiiight。
我期望链接本身重写。因此,基本上,如果我希望链接转到功能/1,我应该做到这一点。feature.php?id = 1链接不会神奇地更改为功能/1,并链接到功能/1。
好吧,您每天都学到一些东西。