【发布时间】:2017-06-02 19:33:06
【问题描述】:
我有这个 URL:http://localhost/fixbud/ 作为我的主页 URL。我的页面渲染良好。但是当我转到另一个链接时:http://localhost/fixbud/answer_forum 我收到错误 404。
这是我的路线:
$route['default_controller'] = "fixbudd";
$route['404_override'] = '';
$route['index'] = "fixbudd/index";
$route['answer_forum'] = "fixbudd/answer_forum";
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
配置
$config['base_url'] = 'http://localhost/fixbud/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
你能告诉我路由 URL 的规则以及如何解决我的问题吗? 我正在使用 CI2
【问题讨论】:
-
可能是 url 重写问题
-
你添加
htaccess文件了吗? -
抱歉,我已经编辑了我的帖子并包含了我的 htaccess
-
你能从这里访问你的网址吗:localhost/fixbud/index.php/answer_forum
-
同时检查您的
application/config.php文件并检查$config['index_page']变量。如果你有index.php则删除它
标签: php codeigniter routes