Mod重写301将https与www重定向到仅https

时间:2014-10-26 11:36:10

标签: .htaccess mod-rewrite redirect

我正在尝试重定向,

  

https://www

到https,但没有成功。

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^https://www.site.domain$
RewriteRule (.*)$ https://site.domain/ [R=301,L]

这是我尝试过的。

1 个答案:

答案 0 :(得分:0)

%{HTTP_HOST}仅匹配没有协议http://https://的主机名。

DocumentRoot/.htaccess

中使用您的规则
RewriteEngine On

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(ivon\.bg)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]