2016-11-16 51 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]