有人可以帮我解决如何替换查询字符串的问题。我想重定向URL(我要求从查询字符串URL中删除%2Fcontent%2Fabc
)。
来自:
http://something.com/en-US/login.html?resource=%2Fcontent%2Fabc%2Fen-US%2Fxyz.html&$$login$$=%24%24login%24%24
为:
http://something.com/en-US/login.html?resource=%2Fen-US%2Fxyz.html&$$login$$=%24%24login%24%24
我尝试使用重写条件和规则,但没有运气。
RewriteCond %{QUERY_STRING} ^resource=%2Fcontent%2Fabc(.*)$
RewriteRule ^/(.*)?resource=%2Fcontent%2Fabc(.*)$ /$1?resource=%2 [L]