一个重写规则或htaccess中的多个重写规则

时间:2017-04-07 21:54:05

标签: .htaccess

我有一个主域名,几个插件域,最近还有https。这对我有用,但我想你的意见:

## All http requests to the relative https url
RewriteCond %{SERVER_PORT} 80 [OR]
## redirect the other domains and the non www main main domain
RewriteCond %{HTTP_HOST} ^domain3.com [OR]
RewriteCond %{HTTP_HOST} ^www.domain3.com [OR]
RewriteCond %{HTTP_HOST} ^domain2.com [OR]
RewriteCond %{HTTP_HOST} ^www.domain2.com [OR]
RewriteCond %{HTTP_HOST} ^maindomain.com
## this stuff is for SSL
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
## i send them all to the https main domain
RewriteRule ^(.*)$ https://www.maindomain.com/$1 [L,R=301]

这是为每种条件设置重写规则的更好方法吗?

0 个答案:

没有答案