2016-12-22 161 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">