如何使此正则重写规则适用于 /和 /没有 /?
我制作了以下重定向规则,以用于WordPress的htaccess中,这似乎有效:
RewriteCond %{REQUEST_URI} /nl/my-impact/
RewriteRule ^nl/(.+)$ $1nl/ [R=301,L]
但是它应该重定向:
https://alivetoearth.org/nl/my-impact/my-impact/florian
https ://alivetoearth.org/nl/my-impact/florian/
to: https://alivetoearth.org/my-impact/florian/nl/
我如何确保在两种情况下都能工作?
现在,我可以使它在一个或另一个中起作用。如果有一种更好的方法来编写整个重定向,我也很想知道。
I made the following redirect rule to be used in htaccess for Wordpress which seems to work:
RewriteCond %{REQUEST_URI} /nl/my-impact/
RewriteRule ^nl/(.+)$ $1nl/ [R=301,L]
But it should redirect both:
https://alivetoearth.org/nl/my-impact/florian
https://alivetoearth.org/nl/my-impact/florian/
to:https://alivetoearth.org/my-impact/florian/nl/
How can I make sure it works in both cases?
Now I can just make it work in one or the other. If there is a better way to write the entire redirect I would also love to know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用此重定向规则:
You may use this redirect rule: