【发布时间】:2016-11-08 09:08:40
【问题描述】:
我想从 url 项目文件夹中删除“index.php”链接,但它返回错误 404 Page Not Found。
我的默认网址是:
http://localhost/training/belajaradmin/
它工作得很好。这个网址也是如此
http://localhost/training/belajaradmin/index.php/login
但是,当我在删除 index.php:
http://localhost/training/belajaradmin/login
时放置此 URL 时,代码不起作用。
我使用codeigniter 2.2.6。下面的代码是文件的名称和我所做的更改。
.htaccess 在根目录
RewriteEngine on
RewriteCond $1 !&(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
“应用程序”文件夹中的 config.php
$config['base_url'] = 'http://localhost/training/belajaradmin/';
$config['index_page'] = '';
'application'文件夹中的autoload.php
$autoload['helper'] = array('url');
'application'文件夹中的routes.php
$route['default_controller'] = "login";
【问题讨论】:
-
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]
-
我这样做了,但它不起作用
标签: php codeigniter codeigniter-2