将https://www.subdomain.domain.com/重定向到https://subdomain.domain.com

时间:2012-11-16 01:00:10

标签: apache .htaccess mod-rewrite

我想将https://www.subdomain.domain.com/重定向到https://subdomain.domain.com,我们已将其包含在htaccess文件中,但它不起作用:

RewriteCond %{HTTPS_HOST} ^www\.([^.]+)\.domian\.com$
RewriteRule ^(.*)$ https:// %1.domian.com/$1 [L,R]

1 个答案:

答案 0 :(得分:0)

这会将所有https和www重定向到非等效的www:

RewriteCond %{HTTPS}=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R,L]
相关问题