2013-04-30

CodeIgniter 隱藏 index.php

雖然網路上別人寫了很多資料了,不過還是自己筆記一下。


1.打開Apache  的httpd.conf
   搜尋 LoadModule找到下面這行
   #LoadModule rewrite_module modules/mod_rewrite.so
   將前面的#字號去除後存檔

2.restart Apache

3.將CodeIgniter資料夾下的.htaccess檔用筆記本打開修改內容
<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /網站路徑
    RewriteCond $1 !^(index\.php|images|robots\.txt|js)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

*註:RewriteBase /網站路徑
如果網站是在根目錄 則修改如下
RewriteBase /

參考說明ex.
如果網址是 http://localhost/
則 RewriteBase /

如果網址是 http://localhost/abc/kkk
則 RewriteBase /abc/kkk


參考資料
快快樂樂刪除CodeIgniter index.php
 [CodeIgniter] 移除網址的index.php
CodeIgniter 隱藏 index.php

沒有留言:

張貼留言

[Unity] Odin Inspector DateTime 時間屬性繪製

Odin Inspector 是一個有名的Unity Inspector Plugin,但沒有為 DateTime 建立可編輯的可視化介面,這邊簡單提供一個可用的方法 。 Odin Inspector 版本 : 3.3.1.14