多RewriteConditions:一套规则之前如何串连他们? [英] Multiple RewriteConditions: How to chain them before a set of rules?

查看:110
本文介绍了多RewriteConditions:一套规则之前如何串连他们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Q1 :如何链这两个条件,使它们的 如果A和B,然后继续... 结果
Q2 :如何使他们粘低于他们所有的RewriteRules而不仅仅是它们下面的一个规则

 的RewriteCond%{REQUEST_URI} ^ IMAGE  -  * $ //如果文件名以IMG-并开始,
的RewriteCond%{} REQUEST_FILENAME -f //如果文件不存在,然后继续!
重写规则规则1
规则2重写规则
重写规则规则3
重写规则Rule4
重写规则Rule5//停在这里END IF


解决方案

您不能这样做的。你必须要么重复你RewriteConds或使用引用做这一切在一个规则重新考虑你的重写规则。第一条路线,虽然不是pretty,将是最容易的。所以

 一的RewriteCond
的RewriteCond乙
重写规则1一的RewriteCond #duplicate
的RewriteCond乙#duplicate
2重写规则

Q1: How to chain these two conditions making them if BOTH A AND B, then proceed...
Q2: How to make them sticky for all the rewriteRules below them and not just the one rule below them?

RewriteCond %{REQUEST_URI} ^IMAGE-.*$      // if filename starts with IMG- and,
RewriteCond %{REQUEST_FILENAME} !-f        // if file does exist, then proceed:
RewriteRule Rule1
RewriteRule Rule2
RewriteRule Rule3
RewriteRule Rule4
RewriteRule Rule5

// STOP HERE END IF 

解决方案

You can't do it that way. You have to either repeat your RewriteConds or rethink your rewrite rule using references to do it all in one rule. The first route, though not pretty, would be the easiest. so

RewriteCond A
RewriteCond B
RewriteRule 1

RewriteCond A #duplicate
RewriteCond B #duplicate
RewriteRule 2

这篇关于多RewriteConditions:一套规则之前如何串连他们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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