(1)要修改Apache 的配置文件,讓Apache支持rewrite_module,修改過程如下:打開apache的配置文,conf/httpd.conf :LoadModule rewrite_module modules/mod_rewrite.so,把該行前的#去掉;(2)搜索 AllowOverride None 即 Options Indexes FollowSymLinks MultiViews下面那個,修改為 AllowOverride All (一般情況下是有兩個,兩個都要修改?。?/p>
2、項目的根目錄(與index.php文件是同一級目錄)下新建一個.htaccess文件,并寫入如下內容:RewriteEngine onRewriteBase /ci/PRoject //注意這里面的/ci/project/表示的是項目名稱的(apache配置項目時的目錄名稱)RewriteCond $1 !^(index/.php|images|robots/.txt) //對于樣式、JS、靜態元素是不能rewrite的所以加這一句RewriteRule ^(.*)$ index.php/$1 [L]或:RewriteEngine onRewriteCond $1 !^(index/.php|images|robots/.txt)RewriteRule ^(.*)$ /ci/project/index.php/$1 [L]3、修改CI框架下的‘/application/config/config.php’配置文件: $config['index_page'] = "index.php"; 修改為 $config['index_page'] = ""; 實例: 初始訪問“helloworld”頁面鏈接:localhost/ci/project/index.php/helloworld 修改后訪問鏈接:localhost/ci/project/helloworld
新聞熱點
疑難解答
圖片精選