2016-11-16 40 views
-1

简单的问题(我希望)。 我有一个需要从url中删除查询,并重写它只保留字符串。mod_rewrite删除查询并保留字符串

例子:

http://example.com/photography/?c=events 

而最终的结果应该是:

http://example.com/photography/events 
+0

可能重复[参考:mod \ _rewrite,URL重写和“漂亮链接”解释](http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links -explained) – Croises

回答

0

什么:

RewriteEngine on 

# capture the value of c parameter of the query string (as %1) 
RewriteCond %{QUERY_STRING} (?:^|&)c=([^&]+) 
RewriteRule ^photography/$ $0%1? [L] 

相关问题