的想法:我希望把它任何东西的域名后到来和结束以.html由index.php文件作为GET变量处理问题与阿帕奇(与WAMP)的mod_rewrite
例子:www.test.ro/1/2/3.html
实际上应该是www.test.ro/index.php?var=1/2/3.html
。
www.test.ro
被设置为虚拟主机进行开发,并且AllowOverride
具有值All。
.htaccess文件似乎被处理,但不是所有的时间。如果我编写一个不可识别的规则,如'BizzareRule',则服务器工作时不会返回代码500错误。 如果我在<IfModule mod_rewrite.c></IfModule>
之间放置了正确的规则,即使我有其他使用相同条件并完美工作的虚拟主机,也会得到500错误。
这里是我的虚拟主机的内容:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.test.ro
ServerAlias test.ro
DocumentRoot D:/Projects/grabsite/test.ro
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php index.html
LogLevel warn
ErrorLog D:/Projects/grabsite/test.ro/error.log
CustomLog D:/Projects/grabsite/test.ro/access.log combined
<Directory "D:/Projects/grabsite/test.ro">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
和测试内容的.htaccess:
RewriteEngine On
RewriteRule ^/?([^/]*)\.html$ /index.php?seo=$1 [L]