我頭痛地嘗試在Apache中設置虛擬主機以使用codeigniter。如何刪除WWW前綴,添加https並重寫codeigniter mod_rewrite?
我想: - 刪除WWW(如果存在的話) - 重定向到HTTPS - 重寫請求頭重定向到笨解析
這裏是我到目前爲止的代碼:
RewriteEngine on
RewriteBase/
RewriteCond %{HTTPS} off
RewriteRule (.*) https://abc.com%{REQUEST_URI} [L]
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule^http://%1%{REQUEST_URI} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ https://abc.com/index.php?q=$1 [L,QSA]
但它根本不起作用;我在這裏做錯了什麼?
只是小白打樣的問題;你確實在Apache中啓用了mod_rewrite嗎?當然是 –
;)noob-proofed。 – Disco