CodeIgniter在url中没有index.php的访问控制器

时间:2015-01-03 15:03:48

标签: php .htaccess codeigniter

我想在访问控制器时从url中删除index.php 这是当前的工作网址:http://localhost/jplugins/index.php/home/index/
但是当我使用url:http://localhost/jplugins/home/index/

访问时,它会出错(404 Page Not Found)

以下是我在stackoverflow上搜索时尝试的内容:
1.在config / config.php中设置$config['index_page'] = "";
2.放置.htaccess,我已经尝试了在线程中找到的每个htaccess文件..没有用
3.在xampp中启用重写模块
4.设置$config['base_url'] = 'http://localhost/jplugins/';也没有用
5.重新安装Xampp。没变
6.更改$config['uri_protocol'] = 'AUTO';。我已经尝试了注释中列出的每个方法,但它只提供了主页/索引输出,无论查询是什么,例如http://localhost/jplugins/asdwhadsadasdasdasdadas/asdasda//asdad - >将提供与http://localhost/jplugins/index.php/home/index/相同的输出。
最后,我将整个代码发送给也使用xampp的人。它完美地在那里工作。使用相同的xampp版本3。2。1(2013年5月7日)。
我使用Windows 7 32位。
这可能是什么问题?

1 个答案:

答案 0 :(得分:1)

.htaccess目录中创建jplugins文件,并添加以下代码:

RewriteEngine On

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
相关问题