在codeigniter中找不到网址

时间:2016-12-10 02:44:19

标签: codeigniter-3

我是CodeIgniter的新手。我在 ayaz 中有一个名为 ci_first2 的简单项目。当我在url中写localhost / ayaz / ci_first2然后打开项目。 enter image description here

但是当我点击链接时,页面没有打开并显示错误: enter image description here

但是当我写localhost / ayaz / ci_first2 / index.php时,一切都运行正常。 enter image description here

点击主页: enter image description here

点击产品: enter image description here

我使用了CodeIgniter 3.1.2:我想从url中删除index.php,并在没有它的情况下使其工作。帮助我的朋友,提前谢谢。

的config.php:

1 个答案:

答案 0 :(得分:0)

您必须在根目录中添加.htaccess文件。只需在根目录(ci_first2)中创建一个名为.htaccess的新文件。并输入以下代码....

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

.htaccss文件用于URL重写。

change $config['index_page'] = '';present in application/config/config.php file

change $config['base_url']='http://localhost/ayaz/ci_first2';
相关问题