如何重定向:
https://www.portal-gestao.com/entrar-na-sua-conta.html?redirecionar=/f%C3%B3rum-perguntas-e-respostas/conversation/read.html?id=25
要:
https://www.portal-gestao.com/f%C3%B3rum-perguntas-e-respostas/conversation/read.html?id=25
使用.htaccess
和regex
?
我正在尝试:
RewriteCond %{THE_REQUEST} /entrar-na-sua-conta.html?redirecionar=/([^\s&]+) [NC]
RewriteRule ^ https://www.portal-gestao.com/%1? [L,R=302]
和
RewriteRule ^entrar-na-sua-conta.html?redirecionar=/(.*)$ /$1 [R=301,L]
答案 0 :(得分:0)
?是正则表达式中的一个特殊字符,所以你需要以cond的模式转义它以匹配?字面意思:
RewriteCond %{THE_REQUEST} /entrar-na-sua-conta.html\?redirecionar=/([^\s&]+) [NC]
RewriteRule ^ https://www.portal-gestao.com/%1? [L,R=302]