天地不仁 发表于 2011-10-14 10:11:45

CI伪静态如何写

比如有个地址http://www.ddd.com/index.php/category/1
现在我要把这地址改为http://www.ddd.com/index.php/1
.htaccess里面的这个规则应该怎么写?求高手帮忙,谢了

baiyuxiong 发表于 2011-10-14 10:34:38

你要不去index.php的话跟.htaccess没啥关系。

直接用CI的路由就能实现 :
http://codeigniter.org.cn/user_guide/general/routing.html

斯达客 发表于 2011-10-14 12:41:19

你这路由违背了CI的路由 ,你只能自己来写。而且你的控制器是category
你只能把他改成 http://www.ddd.com/category /1

.htaccess里面的规则
RewriteEngine on
RewriteCond $1 !^(index\.php|system\.php|images|skin|js|ls|swfupload|attachment|application|robots\.txt)
RewriteRule ^(.*)$ /fx/index.php/$1


注: RewriteRule ^(.*)$ /web1/index.php/$1 里的web1是你的CI程序目录
页: [1]
查看完整版本: CI伪静态如何写