codeigniter rewrite规则配置(apache)
2009年12月23日
没有评论
第一步:修改apache配置文件。
DocumentRoot “E:/website”
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory “E:/website”>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
LoadModule rewrite_module modules/mod_rewrite.so
第二步:在站点根目录加.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|public|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
PS:如果用了rewrite,记得过滤你图片文件夹和样式文件夹,如我的站点的图片/样式/脚本的文件夹分别为images/css/js,.htaccess文件第行的内容改为RewriteCond $1 !^(index\.php|images|css|js|public|robots\.txt)