此应用程序是使用Codeigniter 3.1.3版本构建的。在构建此应用程序时,它可以正确运行此htaccess文件,但今天当我运行此应用程序时,遇到了以下类型的错误。
当运行我的Codeigniter网站时,htaccess文件无法重写我的index.php网址。因此,显示了请求的URL未找到错误。
正确工作的URL => localhost/Magpie/index.php/Front_master/aboutus.html
错误的URL => localhost/Magpie/index.php/Front_master/aboutus.html
这是我的htaccess代码:
控制器文件:Front_master.php
当运行我的Codeigniter网站时,htaccess文件无法重写我的index.php网址。因此,显示了请求的URL未找到错误。
正确工作的URL => localhost/Magpie/index.php/Front_master/aboutus.html
错误的URL => localhost/Magpie/index.php/Front_master/aboutus.html
这是我的htaccess代码:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /Magpie/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
控制器文件:Front_master.php
<?php
class Front_master extends CI_Controller {
public $result = array();
public function __construct() {
parent::__construct();
//load models
$this->result["getContact"] = $this->GetInformation->getContact();
$this->result["getLogo"] = $this->GetInformation->getLogo();
$this->result["getSlide"] = $this->GetInformation->getSlide();
$this->result["getServices"] = $this->GetInformation->getServices();
$this->result["getContent"] = $this->GetInformation->getContent();
$this->result["getPropertyListing"] = $this->GetInformation->getPropertyListing();
$this->result["getBestDeal"] = $this->GetInformation->getBestDeal();
$this->result["getTeam"] = $this->GetInformation->getTeam();
}
public function index() {
$data = array();
$data['title'] = 'Home Page';
$data['header'] = $this->load->view('frontview/header', $this->result, TRUE);
$data['slider'] = $this->load->view('frontview/slider', $this->result, TRUE);
$data['dashboard'] = $this->load->view('frontview/dashboard', $this->result, TRUE);
$data['footer'] = $this->load->view('frontview/footer', '', TRUE);
$this->load->view('frontview/master', $data);
}
public function aboutus() {
$data = array();
$data['title'] = 'About Us';
$data['header'] = $this->load->view('frontview/header', $this->result, TRUE);
$data['dashboard'] = $this->load->view('frontview/about_us', $this->result, TRUE);
$data['footer'] = $this->load->view('frontview/footer', $this->result, TRUE);
$this->load->view('frontview/master', $data);
}
}