将 301 重定向添加到工作 RewriteRule
我正在努力解决可能非常简单的问题。
RewriteEngine On
RewriteRule ^sotw/list/([^/]*)/([^/]*)$ /wp-content/plugins/wp-photocontest/view.php?post_id=$1&order=$2 [L]
注意:这是一个使用自定义永久链接的 WordPress 网站。此 URL 重写适用于我想要清理 url 的插件。
旧网址:www.mywebsite.com/wp-content/plugins/wp-photocontest/view.php?post_id=2049&order=
chrono新网址:www.mywebsite.com/sotw/list/2049/chrono
我转发的任何内容到新的网址有效。但我想重定向所有旧网址,我尝试将以下内容添加到我的 RewriteRule 中,但没有成功。
[R=301,L] [L,R=301,NC]
我应该尝试什么?
I am struggling with what is probably a very easy fix.
RewriteEngine On
RewriteRule ^sotw/list/([^/]*)/([^/]*)$ /wp-content/plugins/wp-photocontest/view.php?post_id=$1&order=$2 [L]
NOTE: This is a WordPress site using custom permalinks. This URL Rewrite is for a plugin I want to clean up the url.
Old URL : www.mywebsite.com/wp-content/plugins/wp-photocontest/view.php?post_id=2049&order=chrono
New URL : www.mywebsite.com/sotw/list/2049/chrono
Anything I link forward to the new url works. But I want to to redirect all of the OLD urls I have tried adding the following to my RewriteRule with no luck.
[R=301,L]
[L,R=301,NC]
What should I try instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过 [R=301] 您不需要 L 标志,因为 R 会阻止检查文件的其余部分。
Have you tried just [R=301] you do not need the L flag as R prevents the rest of the file being checked.