【发布时间】:2017-11-10 11:22:52
【问题描述】:
在将我的 codeigniter 项目从 xampp 服务器删除到 Live 服务器后,我在尝试访问我的主页时出现错误,而前面没有 index.php..
这是我的路线:
$route['home'] = 'Pages/view/home';
这是我的配置:
$config['index_page'] = '';
$config['base_url'] = 'http://mysite/newsite';
$config['uri_protocol'] = 'REQUEST_URI';
我的 .htaccess 文件:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
所以当我尝试浏览 www.mysite/home 时,它给了我这个错误:
在此服务器上找不到请求的 URL /index.php/home。
此外,在尝试访问时遇到 404 Not Found 错误 使用 ErrorDocument 来处理请求。
但是当我浏览 www.mysite/index.php/home 时它确实可以工作
我尝试了不同的 htaccess 文件但没有成功
【问题讨论】:
-
嗨,在您的 htaccess 中,您需要将
RewriteRule ^(.*)$ /index.php/$1 [L]更改为RewriteRule ^(.*)$ /newsite/index.php/$1 [L] -
@elddenmedio 谢谢!像魅力一样工作!
标签: .htaccess codeigniter