这是我到目前为止所得到的:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteRule .* index.php?url=$0 [L]
但是,当我去/a?b=c
之类的东西,然后检查GET参数时,a
url
只会b
,{{1}}丢失。我该如何保留?
答案 0 :(得分:25)
如何使用FallbackResource指令:“为未映射到文件的请求定义默认URL”
<Directory /web/example.com/htdocs/blog>
FallbackResource /index.php
</Directory>
这样你就不必在每次请求时调用modRewrite模块。
http://httpd.apache.org/docs/2.2/mod/mod_dir.html#fallbackresource
答案 1 :(得分:17)
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !index.php RewriteRule .* index.php?url=$0 [QSA,L]
您需要在重写规则中使用QSA。