我做了一切从主页加载视图,但网站网址不工作这里是文件视图,我正在加载的是fundme-explore.php在这我正在使用浏览标签中的网站网址链接
<div class="navv">
<ul class="nav navbar-nav">
<li><a class="navbar-brand" id="hm" href = "<?php echo site_url('Welcome/explore') ?>">Explore</a></li>
<li><a class="navbar-brand" id="br" href = "start_a_project.html" >Start a project</a></li>
<li><a class="navbar-brand" id="ab" href = "About_Us.html" >About us </a>
</li>
</ul>
这是我的控制器welcome.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct() {
parent::__construct();
// Load url helper
$this->load->helper('url');
}
public function index()
{
$this->load->view('Fudme-home.php');
}
public function explore()
{
$this->load->view('fundme-explore');
}
}
?>这是我的路径文件
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['welcome/explore/'] = 'welcome/explore';这是我的.htaccess文件
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>这是我得到的错误的图片
this appear when load explore view from main page
我做了所有教程或其他指南中提到的事情,仍然可以发现哪里出了问题,如果你知道的话请帮助我。
发布于 2017-09-19 17:09:42
我认为您需要使用以下代码更改您的htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /YOUR_FOLDER/index.php?/$1 [QSA,L]
</IfModule> 发布于 2017-09-19 22:36:12
在application/config/config.php中,确保‘base_url’配置值不为空。通常,这将是您的基本URL,并带有一个尾随斜杠。
$config['base_url'] = "http://example.com/";还要确保文件名以大写字母开头。welcome.php应为Welcome.php。
这不是您的问题的一部分,但您需要了解的是:您不需要并且应该删除以下路由。
$route['welcome/explore/'] = 'welcome/explore';URL字符串与其对应的控制器和方法之间存在一对一的关系,它们遵循以下模式:domain/controller/method
只有当您想要重新映射关系时,才需要$route。更多细节,请仔细查看Read this。
给定您显示的控制器,URL将调用Welcome类的explore方法,而无需设置任何$route -假设Codeigniter配置正确。
https://stackoverflow.com/questions/46295885
复制相似问题