开发者

How to redirect a WP page with this in the url.. ?page_id=xx

开发者 https://www.devze.com 2023-01-30 15:02 出处:网络
Trying to redirect a page that is here: http://examplepage.com/?page_id=843&cs_search=1&c_=Carefree&s_=AZ

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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消