kao10324 发表于 2017-4-19 18:42:09

二级目录如何去除URL的index.php路径

本帖最后由 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

这样设置返回结果:No input file specified.

Michael锐生 发表于 2017-4-20 09:35:52

貌似你的路由规则写错了http://codeigniter.org.cn/forums/thread-4-1-1.html

kao10324 发表于 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

或者RewriteRule ^(.*)$ user/index.php/$1
或者RewriteRule ^(.*)$ /user/index.php/$1
都无效.
Not Found
The requested URL /index.php was not found on this server.

Michael锐生 发表于 2017-4-28 10:34:28

你这规则怎么匹配user?你需要写匹配是user开头但不是接着index.php的,自动加上index.php。你写的那一大堆规则都用不上
页: [1]
查看完整版本: 二级目录如何去除URL的index.php路径