2014-03-07 72 views
1

我對CodeIgniter非常陌生,所以很明顯我遇到了最基本的問題。我最近試圖實施一個關於當地環境的網站。我正在使用WAMP,並且網站位於www/public_html中。現在,該網站是工作在我的本地主機,但如果我嘗試導航到默認值(default_controler)任何其他頁面返回找不到像CodeIgniter無法找到除default_controller以外的其他任何東西

The requested URL /public_html/signin/login/ was not found on this server 

我認爲,該網站的目的是通過解決其路徑有關的問題本身。我顯然錯過了一些非常基本的東西。

我改變了config.php文件中的base_url的方式。

$config['base_url'] = 'http://localhost/public_html/'; 

我不知道base_url在哪裏或在哪裏改變它。任何幫助將不勝感激。

Zain

+0

你訪問該網站由'http:// localhost /'或'http:// localhost/public_html'? – sunshinejr

+0

使用http:// localhost/public_html /。默認_controller工作。如果我將其從「歡迎」更改爲「登錄」控制器,它就可以工作。但不會從那裏去任何地方。 – user3106759

回答

-3

ther是您的index.php的問題。檢查此行

$config['index_page'] = 'index.php'; 

,如果它的工作原理u必須添加HT訪問文件從烏爾刪除URL的index.php

有很多關於網絡的.htaccess文件代碼嘗試使用一個適合你

+0

謝謝,我會嘗試。 – user3106759

+0

如果使用index.php,它會進入'$ config ['index_page']',而不是'$ config ['base_url']'。 – Samutz

+0

yaa它是一樣的東西..它工作,即使你使用它在基地網址..只是爲了檢查 – Mohan

2

你得到這個問題,因爲你沒有正確配置你的.htaccess文件。在你.htaccess文件文檔根目錄必須滿足下列條件

<IfModule mod_rewrite.c> 
    RewriteEngine On 

    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

在你config.php你需要做

$config['index_page'] = ''; 

你還需要確保你有啓用了mod_rewrite

+0

這個。或者在config.php中設置'$ config ['index_page'] ='index.php';'在本地機器上進行測試,如果你不能啓用mod_rewrite(發生)。 – sunshinejr

+0

謝謝。讓我試試這個。 – user3106759

+0

我已經把這個在我的.htaccess文件中,並刪除所有其他。仍然沒有變化。 – user3106759

相關問題