2014-04-11 84 views
0

我試圖在某些網址上強制使用ssl,在Apache FastCGI上使用以下.htaccess。但問題是,當我嘗試瀏覽http:// [hostname] /籃子時,它重定向到http:// [hostname] /index.php?/basket而不是https:// [hostname] /籃子。以下是代碼。我堅持這個請幫助在fastcgi上強制使用https codeigniter

RewriteEngine on 
RewriteBase/



RewriteCond %{HTTPS} off 
RewriteCond $1 (checkout|basket) 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

RewriteCond %{HTTPS} on 
RewriteCond $1 !(checkout|basket) 
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [QSA,L] 

回答

0

此問題已得到解決:下面是如果別人有同樣的問題代碼:

RewriteEngine on 
RewriteBase/

RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 (checkout|basket) 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 


RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !(checkout|basket) 
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]