我用CodeIgniter3和PHP制作了一个简单的web应用程序。
当在本地开发它时,一切都在完美地工作。 但真的没问题。
然后,我上传到了一个Namecheap Stellar网站托管包。 我可以登录(所以DB连接很好),并且我可以访问仪表板。 但是当我试图转到一个页面,或者使用任何创建的路由时。 我得到一个404错误页面。
没有错误。 我试着改变环境(开发,生产)什么都没有。
下面是.htaccess
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
和VehiculeSGold
控制器:
<?php
class VehiculesGold extends CI_Controller{
public function __construct()
{
parent::__construct();
$this->load->model('Vehicule_model');
if($this->session->userdata('logged_in') !== TRUE){
redirect('login');
}
}
public function index()
{
$type = 'gold';
$data['title'] = "Véhicules GOLD";
$data['vehicules'] = $this->Vehicule_model->get_all_vehicules_type($type);
$this->load->view('vehiculesgold/index',$data);
}
}
VehiculesGold
是Views
文件夹中的文件夹。 index
是views
文件夹(index.php)中的页面。
实际上,只有仪表板和登录页面起作用。
我不知道还有什么信息要补充。。。
非常感谢您的时间和帮助:)
阿莱克斯
尝试将您的。htaccess文件更新为
RewriteEngine On
RewriteEngine / #Add this if the project is in the root of your domain directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L