如何在 url 中使用此重定向 WP 页面.. ?page_id=xx

发布于 2024-10-07 03:26:29 字数 209 浏览 0 评论 0原文

尝试重定向此处的页面:

http://examplepage.com/?page_id=843&cs_search=1&c_=Carefree&s_=AZ

有几个页面的页面 ID 为 843,我想将它们重定向到主页。

我已经尝试了十亿种不同的解决方案,但就是无法完全弄清楚。

谢谢

Trying to redirect a page that is here:

http://examplepage.com/?page_id=843&cs_search=1&c_=Carefree&s_=AZ

There are several pages with the same page id of 843 that I would like to redirect to the home page.

I've tried a billion different solutions, but just can't quite figure it out.

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

辞别 2024-10-14 03:26:29

这应该可以解决问题,并且应该只捕获单个 pageid:

RewriteEngine On
RewriteCond %{QUERY_STRING} ([&]|^)page_id=843([^\d]|$)
RewriteRule (.*) /? [R=301,L]
  • ?page_id=843 Redirected
  • ?a=b&page_id=843 Redirected
  • ?a=b&page_id=843& ;b=c 已重定向
  • ?a=b&aapage_id=843 未重定向
  • ?page_id=8435 未重定向

This should do the trick, and should catch only that single pageid:

RewriteEngine On
RewriteCond %{QUERY_STRING} ([&]|^)page_id=843([^\d]|$)
RewriteRule (.*) /? [R=301,L]
  • ?page_id=843 Redirected
  • ?a=b&page_id=843 Redirected
  • ?a=b&page_id=843&b=c Redirected
  • ?a=b&aapage_id=843 NOT Redirected
  • ?page_id=8435 NOT Redirected
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文