2016-01-12 134 views
0

我有一個Code Igniter項目的小問題,我有一個.htaccess文件來重寫index.php。如果我把我的項目放在本地服務器上,它會很好用。我正在使用WAMP服務器。但是現在我已經將它上載到Live Server上(例如godaddy,00webhost)。它顯示錯誤: 404未找到頁面。找不到您請求的頁面。CodeIgniter .htaccess重寫不能在Live服務器上工作

我的.htaccess是在這裏:

RewriteEngine on 
RewriteBase /directory_name/ 
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favico​​n\.ico) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 

和我的config.php文件設置是在這裏:

$config['base_url'] = 'http://example.com/directory/' ; 
$config['index_page'] = ''; 
$config['uri_protocol'] = 'AUTO'; 

我已經嘗試了網絡上很多解決方案,但不幸運地找到一個誰幫助我。我3天后卡住了。任何人幫助我。

+0

檢查是否在實時服務器上啓用了mod_rewrite模塊。 – Ravneet

+0

檢查他們是否使用Apache? –

+0

@Ravneet可以在現場服務器上檢查mod_rewrite模塊嗎? –

回答

0

如果你想主辦的網站在一個子文件夾,請確保你在你的htaccess以及配置輸入正確的信息:

變化RewriteBase /directory_name/ htaccess的,以RewriteBase /ci_foam/

變化$config['base_url'] = 'http://example.com/directory/'在你的配置,以$config['base_url'] = 'http://php0713061.herobo.com/ci_foam/'

您總是需要確保這些值與您當前的服務器設置相匹配。

+0

Magnus Eriksson ..我已經嘗試過了..但是仍然存在同樣的問題.... –

+0

我的.htaccess是否正常? –

+0

我認爲@magnus的回答是正確的。只需刪除/之後RewriteBase/ci_foam。它可能工作。 – Hedeshy

相關問題