0
從url中刪除字符串,我需要從我的url中刪除一些重複的字符。更具體的,我想使這個網址在我最近的項目中使用htaccess
http://example.com/cgi-bin/file.cgi?ga_option1=a&ga_option2=b&ga_option3=c
成爲這個,取出ga_部分
http://example.com/cgi-bin/file.cgi?option1=a&option2=b&option3=c
我嘗試這樣做:
RewriteEngine On
RewriteBase /cgi-bin/
RewriteRule ^(.*)ga_(.*)$ http://%{SERVER_NAME}/$1-$2 [NC,R=301,L]
這:
RewriteEngine On
RewriteBase /cgi-bin/
RewriteCond %{QUERY_STRING} "ga_" [NC]
RewriteRule (.*) http://example.com/cgi-bin/file.cgi?$1 [R=301,L]
,但沒有任何作品。請給我一些建議。謝謝。
嗨,感謝您的建議,但它沒有奏效。我不確定,但是它與RewriteBase規則有什麼關係? – camelot