带参数重定向和多个查询
我想重定向这个网址 https://www.mydomain.fr/mon-compte-membre/?ihcnewlevel=true&lid=7&urlr=https%3A%2F%2Fwww.mydomain.fr%2Fservices%2F
至`https://www.mydomain.fr/slug/
编辑 这是编辑后的代码(仍然不起作用)
<IfModule mod_rewrite.c>
RewriteCond %{THE_REQUEST} /mon-compte-membre/ [NC]
RewriteCond %{QUERY_STRING} (^|&)ihcnewlevel=true(&|$) [NC]
RewriteCond %{QUERY_STRING} (^|&)lid=7(&|$) [NC]
RewriteCond %{QUERY_STRING} (^|&)urlr=https%3A%2F%2Fwww\.mydomain\.fr%2Fservices%2F [NC]
RewriteRule ^ /slug/ [R=302,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I want to redirect this urlhttps://www.mydomain.fr/mon-compte-membre/?ihcnewlevel=true&lid=7&urlr=https%3A%2F%2Fwww.mydomain.fr%2Fservices%2F
To `https://www.mydomain.fr/slug/
EDIT
This is the edited code (still not working)
<IfModule mod_rewrite.c>
RewriteCond %{THE_REQUEST} /mon-compte-membre/ [NC]
RewriteCond %{QUERY_STRING} (^|&)ihcnewlevel=true(&|$) [NC]
RewriteCond %{QUERY_STRING} (^|&)lid=7(&|$) [NC]
RewriteCond %{QUERY_STRING} (^|&)urlr=https%3A%2F%2Fwww\.mydomain\.fr%2Fservices%2F [NC]
RewriteRule ^ /slug/ [R=302,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
?
来去掉任何先前的查询字符串%
字符,因此您必须按字面匹配它们您可以使用:
对结果感到满意后,请将
302
替换为301
。?
in the target to strip off any previous query string%
characters in query string so you will have to match them literallyYou may use:
Once you're satisfied with the result, replace
302
with301
.