我想我的二级域名重定向到我的.COM的主域,当我访问domain.asia或者使得www.domain.asia重定向的URL的 https://www.domain.com 。我遇到的问题是,重定向进入 https://www.domain.asia (不是.COM )及.ASIA域不具有安全证书并且因为这种显示一个警告。
我如何可以访问domain.asia并将它重定向到 https://www.domain.com ?
二级域名停放在同一台服务器作为主域上。这是我的.htaccess文件:
#重定向到.COM
的RewriteCond%{HTTP_HOST} ^(WWW )?域 .CO .UK $ [NC]
的RewriteCond%{HTTP_HOST} ^(WWW )?域 .ASIA $ [NC]
重写规则^(。*)$ https://www.domain.com/$1 [R = 301,L]
#重定向到www
的RewriteCond%{HTTP_HOST}!^ WWW 。
(。*)重写规则^ $ HTTP://www.% {HTTP_HOST} / $ 1 [R = 301,L]
#重定向到https,如果不
的RewriteCond%{} HTTPS!=上
的RewriteCond%{HTTP_HOST} ^(WWW )?域 .COM $ [NC]
重写规则^ https://开头%{HTTP_HOST}%{REQUEST_URI} [R = 301,L]
解决方案
您必须使用:
#重定向到.COM
的RewriteCond%{HTTP_HOST} ^(WWW )?域 .CO .UK $ [OR,NC]
的RewriteCond%{HTTP_HOST} ^(WWW )?域 .ASIA $ [NC]
重写规则^(。*)$ https://www.domain.com/$1 [R = 301,L]
与或,使用此规则条件结合本地或代替隐式和。
I am wanting to redirect my secondary domain to my .com primary domain, such that when I visit domain.asia or www.domain.asia it redirects the URL to https://www.domain.com. The problem I am having is that the redirect goes to https://www.domain.asia (not the .com) and the .asia domain does not have a security certificate and because of this shows a warning.
How can I visit domain.asia and have it redirected to https://www.domain.com?
The secondary domain is parked on the same server as the primary domain. Here is my .htaccess file:
# redirect to .com
RewriteCond %{HTTP_HOST} ^(www.)?domain.co.uk$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?domain.asia$ [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
# redirect to www
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# redirect to https if not
RewriteCond %{HTTPS} !=on
rewritecond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
解决方案
You have to use:
# redirect to .com
RewriteCond %{HTTP_HOST} ^(www.)?domain.co.uk$ [OR,NC]
RewriteCond %{HTTP_HOST} ^(www.)?domain.asia$ [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
with OR, Use this to combine rule conditions with a local OR instead of the implicit AND.
相关推荐
最新文章