我的 .htaccess 永久重定向代碼無法正常作業:
RedirectPermanent ^shop/?attro-attributes=([0-9]*) http://www.second-website.example
我想從第一個網站重定向 URL:
first-website.example/shop/?attro-attributes=01first-website.example/shop/?attro-attributes=02first-website.example/shop/?attro-attributes=...first-website.example/shop/?attro-attributes=9999
到第二個網站 URL:http://www.second-website.example/
uj5u.com熱心網友回復:
RedirectPermanent和其他重定向指令mod_alias無法訪問查詢字串。您的匹配模式不能包含?來自 URL 或匹配它之后的任何內容。
您將不得不使用mod_rewritewhich 可以通過RewriteCond.
RewriteEngine on
RewriteCond %{QUERY_STRING} attro-attributes=[0-9]*
RewriteRule ^/?shop/$ https://www.second-website.example/ [L,R=301]
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/425158.html
上一篇:我想用.htaccess將https://blog/home/post?read=example重寫為https://blog/home/example
