2016-12-22 259 views
0

我知道这已被问了很多次,并相信我已经打开了他们所有的步骤,但仍然困扰着我。 css也搞乱了(http://anakpanti.com/ab-cargo/CodeIgniter - 控制器未找到

我有CI项目,它在我的本地主机上工作,但是在我将它移动到webhosting后,找不到控制器(默认的那个除外)。

在此服务器上未找到请求的URL/ab-cargo/controllers_aboutus /。 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。

在这里我做了什么:

  • 变化的第一个字母控制器类资本
  • 变化的第一个字母的文件名控制器资本

Change.htaccess代码到这一点:

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
</IfModule> 
  • 更改文件配置为:

    $config['base_url'] = 'http://anakpanti.com/ab-cargo/';

    $config['index_page'] = '';

这就是所有的步骤。

回答

1

哦,我知道这个问题。

应该有 .htaccess文件放置在项目中。

首先,在根文件夹

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
</IfModule> 

而且还应用程序文件夹里面

<IfModule authz_core_module> 
Require all denied 
</IfModule> 
<IfModule !authz_core_module> 
Deny from all 
</IfModule> 
+0

三江源样式表中头使用BASE_URL()那么多。最后! –

0

这是你的BaseURL权(http://anakpanti.com/ab-cargo/)。 S添加rewiteBase/ab-cargo。 使用此的.htaccess

RewriteEngine On 
RewriteBase /ab-cargo 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 

当包括href标记

<link rel="stylesheet" href="<?php echo base_url();?>CSS/main.css" type="text/css">