2016-03-17 65 views
1

這是我在網上託管的目錄結構在笨刪除的index.php給404錯誤

--/
    -- up 
    -- .logs 
    -- public_html 
     -- application 
     -- system 
     -- user_guide 
     -- .htaccess 
    -- DO_NOT_UPLOAD_HERE 

在我的config.php,我寫了這個代碼:

$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/'; 
$config['index_page'] = ''; 
$config['uri_protocol'] = 'AUTO'; 
在我的.htaccess文件

,我有這樣的下面的代碼:

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

我想從我的網址刪除index.php文件,所以它會顯示mydomain.com/class/controller而不是mydomain.com/index.php/class/controller

它在我的本地主機上運行平穩,我在LAMPP服務器上使用Ubuntu 15.10。但是,當我嘗試在線的所有代碼時,它會顯示404錯誤頁面。

這是我即將成爲-IF-工作,妥善網站:onesource.esy.es

這有什麼錯我的代碼?

回答

0

你的mod_rewrite規則重定向到/index.php而不是/codeigniter/index.php。

在.htaccess文件將這個:

RewriteBase /笨/

+0

哪裏'codeigniter'從何而來?因爲我沒有這樣的名字的文件夾。我所有存儲在名爲'public_html' – Ary

+0

的文件夾中的codeigniter目錄仍然不能正常工作,隊友 – Ary

0

在我的情況下(使用CI 3),我已經改變了在配置的uri_protocol。嘗試將的application/config/config.php文件並改變:

$config['uri_protocol'] = 'REQUEST_URI'; 

希望這有助於。如果沒有,也許這裏還有更多的建議:

CodeIgniter removing index.php from url

+0

仍然不能正常工作。 – Ary