2015-12-10 48 views
2

我發現這個問題的幾個答案,但略有不同,有趣的是,它不適合我。.htaccess HTTPS並刪除index.php

我的目標是任何URL重寫HTTPS和刪除的index.php

基本上我想要的是合併以下兩個htaccess中,但我有點新的htaccess的語法:

RewriteEngine On 
RewriteBase/

# If needed add 'www' 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] 

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

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php?/$0 [PT,L] 

回答

1

試試這個:

RewriteEngine On 

RewriteBase/
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R,L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php?/$0 [PT,L] 
+1

工程就像一個魅力,thnx! – hreitsma