IIRF 1.2.16, How can these Three rules be combined into one

Topics: Developer Forum
Oct 24, 2009 at 2:32 AM
Edited Oct 24, 2009 at 3:44 AM

Language:Chinese Simplified(zh-cn)

IIRF 1.2.16,请问如何将这三条规则合并成一条

希望重写所有子域名,当然,不包含www和local开头的两个子域名。

我搜索了很多中文的资料,只找到适用于IIRF 2.0版本的

谢谢

Google Translate

http://www.google.com/language_tools?hl=en

 
IIRF 1.2.16, How can these Three rules be combined into one
 
Want to rewrite all the sub-domains, of course, does not include www and local at the beginning of the two sub-domains.

I searched for a lot of Chinese data, found only applies to IIRF 2.0 version of the
Thanks

 

RewriteCond %{HTTP_HOST} www.x2009.cn
RewriteRule ^(.*)$ $1 [I,L]

RewriteCond %{HTTP_HOST} local.x2009.cn
RewriteRule ^(.*)$ $1 [I,L]

RewriteCond %{HTTP_HOST} (.*).x2009.cn
RewriteRule ^(.*)$ /%1$1 [I,L]

 

Coordinator
Oct 24, 2009 at 4:55 AM

Why do you want to combine three rules into one?   Do the three rules not work as you desire?

If I were producing these rules I would combine the first two rules.  And the third would remain separate.

# NO REWRITE for hostname www.x2009.cn or local.x2009.cn
RewriteCond  %{HTTP_HOST}   ^(www|local)\.x2009\.cn$  [I]
RewriteRule  ^/(.*)$        -                         [L]

# REWRITE requests for other host names
# eg, http://foo.x2009.cn/Hello becomes
#      http://foo.x2009.cn/fooHello 
RewriteCond  %{HTTP_HOST}     ^(.*)\.x2009\.cn
RewriteRule  ^/(.*)$          /%1$1                  [L]
Oct 24, 2009 at 5:47 AM
Edited Oct 24, 2009 at 6:07 AM
 

你好,我觉得更少的规则会使运行效率更高,理解和修改起来也更加容易,可能是我被误导了吧。

也是因为我在互联网上看到有的规则是写成一条,我在iirf2.0中测试中通过。因为对正规表达式知道的还不是很多,所以以为实现起来不会很难。

可能是我没有表达好,我修改了一下规则。已经没有问题了,谢谢!

Hello, I think the rules will run less efficient, and modify them to understand and more easily, perhaps I was misled bar.

Partly because I was on the Internet, some rules are written as one can see, I have tested iirf2.0 through. Because the regular expression is not yet known to many, so I thought up would not be difficult to achieve.

Perhaps I did not express well, I modified the rules a bit. There are no questions, thank you!
 
 
# NO REWRITE for hostname www.x2009.cn or local.x2009.cn
RewriteCond  %{HTTP_HOST}   ^(www|local)\.x2009\.cn$  [I]
RewriteRule  ^/(.*)$        -                         [L]

# REWRITE requests for other host names
# eg, http://foo.x2009.cn/Hello becomes
#      http://foo.x2009.cn/fooHello
RewriteCond  %{HTTP_HOST}     ^(.*)\.x2009\.cn
RewriteRule  ^(.*)$          /%1$1                  [L]
Coordinator
Oct 25, 2009 at 1:56 AM

OK !!

 

Jan 6, 2010 at 11:30 AM

楼主QQ多少啊?我有问题问你啊

加我的QQ 46-152-057