使用.conf文件(httpd / Apache2)将所有流量重定向到https:// www

时间:2017-04-01 11:37:29

标签: apache .htaccess

我希望以下地址重定向到https://www.foobar.com

 - http://www.foobar.com
 - http://foobar.com
 - https://foobar.com

我尝试过使用它,但它不起作用:

等/ httpd的/ conf.d / ssl_rewrite.conf

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

1 个答案:

答案 0 :(得分:0)

RedirectMatch permanent ^(.*)$ https://www.foobar.com$1
相关问题