Apache Rewrite解决问号匹配的写法

发布时间:2015-12-18 16:10:43编辑:丝画阁阅读(822)

把 /abc?id=123  =>  /def.php?id=123 的写法:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=(.+)$
RewriteRule ^/abc$ /def.php?sid=%1 [L]

RewriteRule 不会去匹配 ? 后面的字符串,需要用RewriteCond来匹配
参考:http://lists.apple.com/archives/web-dev/2006/Mar/msg00005.html

关键字