的RewriteCond%{REQUEST_URI}:如何停止,如果REQUEST_URI含有P =约或P =接触? [英] RewriteCond %{REQUEST_URI} : how to stop, if REQUEST_URI contains ?p=about or ?p=contact

查看:386
本文介绍了的RewriteCond%{REQUEST_URI}:如何停止,如果REQUEST_URI含有P =约或P =接触?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建.htaccess文件重写条件检查,如果网址包含设置和参数p =约或P =接触的参数p。 在情况下,如果P =约或P =联系,重写规则即低于不应该berformed。 任何人可以帮助我的RewriteCond?

I'm trying to create a rewrite condition in .htaccess file to check if url contains a parameter p that is set and parameter p=about or p=contact. In case, if ?p=about or ?p=contact, the RewriteRule that is below should NOT be berformed. Could anybody help me with RewriteCond?

RewriteCond %{REQUEST_URI} (?p=about_us|?p=contact)

不能正常工作。

does NOT work.

推荐答案

下的RewriteCond将匹配如果查询字符串没有一个 P 参数,值为关于我们联系人即下面的规则将不会执行,如果有AP = 关于我们联系人

The RewriteCond below will match if the query string does not have a p param with a value of about us or contact i.e the following rule will not execute if it has a p= about us or contact

RewriteCond %{QUERY_STRING} !(^|&)p=(about_us|contact)(&|$) [NC]

这篇关于的RewriteCond%{REQUEST_URI}:如何停止,如果REQUEST_URI含有P =约或P =接触?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆