试图将所有http
和none-www
的流量重定向到https
(带或不带www)。 使用.htaccess
和apache VirtualHost
文件:apache重定向http到https而没有www
虚拟主机文件
<VirtualHost *:80>
ServerName adi-md.co.il
ServerAlias www.adi-md.co.il
的.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www\. [NC,OR]
RewriteCond %{HTTP_HOST} ^adi-md.co.il
#RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L,NE]
#RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC]
#RewriteRule (.*) https://www.%1%{REQUEST_URI} [L,R=301]
#RewriteCond %{HTTP_HOST} ^www.adi-md.co.il
选项1
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^adi-md.co.il
选项2
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC]
RewriteRule (.*) https://www.%1%{REQUEST_URI} [L,R=301]
打字的时候只是adi-md.co.il
你的服务器的默认页面。
我该如何解决这个问题,这样所有的流量都被重定向到https
以及none-www
请求?
注: 我已经看过这3个,但他们没有提供答案(2出3处理WWW到无www的)
apache redirect http to https and www to non www
http to https apache redirection
Redirect from http to https without www using .htaccess
结帐http://redirect-www.org/ –