开发者

htaccess redirect using OR and NC

开发者 https://www.devze.com 2023-03-25 15:36 出处:网络
I would like to know if I can do this redirect where I have the domain: example.com be non case sensitive along with the or statement for the IP. Both work indpendently of 开发者_如何学JAVAeach other

I would like to know if I can do this redirect where I have the domain: example.com be non case sensitive along with the or statement for the IP. Both work indpendently of 开发者_如何学JAVAeach other but not together?

RewriteCond %{HTTP_HOST} ^example\.com [OR] [NC]
RewriteCond %{HTTP_HOST} ^123\.45\.67\.89
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


Flags should be listed together separated by comma -- exactly the same way how it's done in RewriteRule itself:

RewriteCond %{HTTP_HOST} ^example\.com [OR,NC]
RewriteCond %{HTTP_HOST} ^123\.45\.67\.89
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Another approach:

RewriteCond %{HTTP_HOST} ^(example\.com|123\.45\.67\.89) [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
0

精彩评论

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