[英]Mod Rewrite - WP url &preview_nonce=(.*)
I would like to change any url containing the query string &preview_nonce=
with any value passed to preview_nonce
. 我想更改任何包含查询字符串&preview_nonce=
URL &preview_nonce=
其任何值传递给preview_nonce
。
I understand that I have to rewrite based on the condition: 我了解我必须根据条件进行重写:
RewriteCond %{QUERY_STRING} ^preview_nonce=(.*)$
But I'm getting caught up only removing that from the query string and leaving everything else, including query strings. 但是,我只能从查询字符串中删除该字符串,并保留所有其他内容,包括查询字符串。
Example URLs: 范例网址:
about-us/history/commitment/?preview=true&preview_id=9999&preview_nonce=9x323k1
stories/companies/?preview=true&preview_id=8888&preview_nonce=c448s88
The desired results: 预期结果:
about-us/history/commitment/?preview=true&preview_id=9999
stories/companies/?preview=true&preview_id=8888
You can use this rule for query string removal: 您可以使用以下规则删除查询字符串:
RewriteCond %{QUERY_STRING} ^(.+?&)?preview_nonce=[^&]*(?:&(.*))?$ [NC]
RewriteRule ^ %{REQUEST_URI}?%1%2 [L,NC,R=302]
Make sure this rule is placed before other WP rules. 确保此规则位于其他WP规则之前。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.