[英]htaccess redirect with special ? character for php string mod_rewrite in apache
我需要使用htaccess重寫規則將帶有AdWords廣告系列中使用的關鍵字字符串的URL重定向回到我的首頁。 這就是我已經嘗試過的...
RewriteRule ^/?keyword=(.*)$ http://{HTTP_HOST}/$1 [R=301]
示例:希望使/?keyword = carrots重定向到我的主頁。
為了處理涉及查詢字符串的重定向,您將需要使用
RewriteCond %{QUERY_STRING}
在您的.htaccess
文件中:
RewriteEngine On
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^$ http://%{HTTP_HOST}/%1/? [NC,L,R=301]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.