2012-02-13 112 views
0

我不能從HTTP重定向到https:'( 我實際的.htaccess看起來像國防部重寫衝突

<IfModule mod_rewrite.c> 
    Options +FollowSymLinks 
    RewriteEngine on  
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-l 
    RewriteRule .* index.php [L] 
</IfModule> 

我加入下一行

RewriteCond %{HTTPS} off 
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

但是,讓衝突以前行。

我把http://www.example.com/lents/johnson.html?type=1到URL。

,取而代之的獲得同樣以https

我越來越https://www.example.com/index.php?type=1

謝謝!

+0

'/倫茨/ johnson.html'實際給你文件的路徑? – ThinkingMonkey 2012-02-13 17:23:02

回答

0

所以重定向發生之前的任何URL重寫的情況,您需要把一切人之上您的重定向規則:

RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule .* index.php [L]