用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1632|回复: 3
收起左侧

[讨论/交流] 二级目录如何去除URL的index.php路径

[复制链接]
发表于 2017-4-19 18:42:09 | 显示全部楼层 |阅读模式
本帖最后由 kao10324 于 2017-4-19 21:46 编辑

在根目录新一个文件夹user,把CodeIgniter框架放入该user文件夹,
如何设置.htaccess移除URL中的index.php
原始链接:域名/user/index.php/welcome/index
想要得到的链接:域名/user/welcome/index
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /user/index.php/$1 [L]

这样设置返回结果:No input file specified.
发表于 2017-4-20 09:35:52 | 显示全部楼层
貌似你的路由规则写错了http://codeigniter.org.cn/forums/thread-4-1-1.html
 楼主| 发表于 2017-4-27 13:33:59 | 显示全部楼层
Michael锐生 发表于 2017-4-20 09:35
貌似你的路由规则写错了http://codeigniter.org.cn/forums/thread-4-1-1.html

ci的代码都放在user文件夹下,在user文件夹下的.htaccess:
RewriteEngine on
RewriteCond $1 !^(lib|index\.php|images|styles|css|skin|captcha|ckeditor|ckfinder|uploadfile|fckeditor|robots\.txt|uc_client|config\.inc\.php|api|include|js|uploads)
RewriteRule ^(.*)$ index.php/$1 [L]

或者RewriteRule ^(.*)$ user/index.php/$1 [L]
或者RewriteRule ^(.*)$ /user/index.php/$1 [L]
都无效.
Not Found
The requested URL /index.php was not found on this server.
发表于 2017-4-28 10:34:28 | 显示全部楼层
你这规则怎么匹配user?你需要写匹配是user开头但不是接着index.php的,自动加上index.php。你写的那一大堆规则都用不上

本版积分规则