2012-05-07 65 views

回答

1

嘗試

RewriteEngine on 
RewriteBase/

RewriteCond %{SERVER_PORT} 443 
RewriteRule ^blog/?(.*) http://ourdomain.com/blog/$1 [R,L] 

RewriteCond %{SERVER_PORT} 443 
RewriteRule ^videos/?(.*) http://ourdomain.com/videos/$1 [R,L] 

RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} !^/videos 
RewriteCond %{REQUEST_URI} !^/blog 
RewriteRule ^(.*)$ https://ourdomain.com/$1 [R,L] 
4

你已經與您使用的RewriteCond限制端口上重寫的請求有部分道路80

要重寫的80端口的請求爲/videos/blog,所以:

RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} !^/videos 
RewriteCond %{REQUEST_URI} !^/blog 
RewriteRule ^(.*)$ https://ourdomain.com/$1 [R,L] 

而且要重新改寫在端口這些URL任務(大概)443:

RewriteCond %{SERVER_PORT} 443 
RewriteRule ^/((videos|blog)/.*) http://ourdomain.com/$1 [R,L] 
+0

嗯,ccKep的可能是更清潔...... – larsks

+0

感謝您的幫助,我得到SPME奇怪的行爲與這兩個解決方案......如果我去到https ://domain.com/blog或/視頻,它不重定向,並保持https,如果我去http://domain.com/videos或/博客它指向主頁https://domain.com –

相關問題