2012-01-10 101 views

回答

2

嘗試將以下內容添加到您的域的根文件夾中的htaccess文件中。

RewriteEngine on 
RewriteBase/


#Non-secure requests to secure.domain.com should redirect to https://secure.domain.com 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^secure\.domain\.com$ [NC] 
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

#All secure (HTTPS) traffic should redirect to https://secure.domain.com 
RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} !^secure\.domain\.com$ [NC] 
RewriteRule .* https://secure.domain.com%{REQUEST_URI} [L,R=301] 


#All other non-secure requests should go to http://www.domain.com 
#Lastly, all non-www requests should redirect to www, except the "secure" subdomain. 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] 
RewriteRule .* http://www.domain.com%{REQUEST_URI} [L,R=301] 
+0

傑出,像一個魅力工作!我知道我過度思考。 – 2012-01-10 22:15:06