【发布时间】:2015-09-19 12:33:52
【问题描述】:
我有一个网站,我已经在子文件夹 (test) 下安装了 CodeIgniter 2 Site
用户可以通过以下链接访问该网站:
当用户使用上述链接 URL 访问 (test) 站点时,重定向到以下链接并显示以下错误。
http://www.example.com/test/login
找不到
在此服务器上找不到请求的 URL /test/login。
然后我将index.php添加到上面的URL,显示登录页面。
http://www.example.com/test/index.php/login
当我再次提交我的用户名和密码时,URL 重定向到,没有登录。
http://www.example.com/test/login
又一次,没有找到。
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
config.php:
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = "AUTO" ;
我已尝试$config['base_url'] = "http://www.example.com/test" - 仍然无法正常工作。
【问题讨论】:
-
你加载了 url helper 吗?在 autoload.php
$autoload['helper'] = array('url'); -
删除//
$config['base_url'] = 'http://www.example.com/test'之间的空格 -
检查所有控制器和模型文件名和类名的首字母大写
-
此站点在本地主机中工作,但在线无法正常工作
-
测试这个
$config['uri_protocol'] = 'PATH_INFO';或$config['uri_protocol'] = 'REQUEST_URI';
标签: php .htaccess codeigniter