![](/img/trans.png)
[英]Codeigniter controller not accessible without index.php in URL
[英]CodeIgniter Access controller without index.php in url
我想在访问控制器时从URL中删除index.php。
这是当前的工作网址: http://localhost/jplugins/index.php/home/index/
但是当我使用url访问时,它会给出错误(找不到404页): http://localhost/jplugins/home/index/
这是我在stackoverflow搜索时尝试过的事情:
1.设置$config['index_page'] = "";
在config / config.php中
2.放置.htaccess,我已经尝试了在线程中找到的每个htaccess文件。
3.在xampp中启用重写模块
4.设置$config['base_url'] = 'http://localhost/jplugins/';
也没有工作
5.重新安装Xampp。 没变
6.更改$config['uri_protocol'] = 'AUTO';
。 我已经尝试了注释中列出的每个方法,但是无论查询是什么,它都只会提供home / index输出,例如http://localhost/jplugins/asdwhadsadasdasdasdadas/asdasda//asdad
>会提供与http://localhost/jplugins/index.php/home/index/
相同的输出http://localhost/jplugins/index.php/home/index/
。
最后,我将整个代码发送给了也使用xampp的人。 它在那里工作完美。 使用相同的xampp版本3.2.1(2013年5月7日)。
我正在使用Windows 7 32位。
这可能是什么问题?
在jplugins
目录中创建一个.htaccess
文件,并添加以下代码:
RewriteEngine On
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.