2013年6月28日 星期五

CodeIgniter mod_rewrite? 問題

CodeIgniter mod_rewrite? 問題
CodeIgniter 2.0
首先注意的几点:
apache的httpd.conf文件中,有两个地方必须设置才能成功开启htaccess
其一: # LoadModule rewrite_module modules/mod_rewrite.so去掉这句前面的#号
其二:找到AllowOverride None,把其中的None改成All。
我的httpd.conf是设置成了多站点模式,配合hosts文件本地实现自定义域名的方式来访问各个不同的站点。每个站点都有一段apache的配置。其中我都加上了AllowOverride All。


當 config.php 配置是PATH_INFO時
※ CodeIgniter 本身設定不支持$_GET,因次AUTO改成PATH_INFO可以改善這問題 $config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
 .htaccess RewriteRule ^(.*)$ index.php/$1 [L] /*注意沒有?號*/


 注意 $config['uri_protocol'] = "AUTO";時
 .htaccess RewriteRule ^(.*)$ index.php/?$1 [L] /*注意有?號*/

PS:在Windows7 X64環境下→環境配置(系統變量)→PATH(E:\AppServ\Apache2.2\bin;E:\AppServ\php5;E:\AppServ\MySQL\bin)必須給值


apache2.2.21下为codeigniter配置url地址重写

http://my.oschina.net/bootstrap/blog/85442

沒有留言:

張貼留言