2012-11-27 119 views
1

我需要2個重定向。首先是任何不是https的請求應該是https。第二個是任何非www應該是www。在下面,https的工作,但第二個不,並在原始網址上。我需要這兩個異口同聲非www重定向與https組合https

# Redirect non https to https 
RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

# redirect non www to www 
RewriteEngine On 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] 

當同時啓用他們的工作,第二個在URL複製了兩次HTTP_HOST。

我需要的是mysite.com重定向到https://www.mysite.com以及http://www.mysite.com重定向到https://www.mysite.com

回答

0

更新:此清除緩存後的工作。

相關問題