2012-07-27 99 views
6

設置我baseurl到:設置的BaseURL的笨

http://localhost/codeigniter/ 

application/config/config.php file如要求通過the installation instructions

我跟隨this tutorial。然而,當我在網址欄中輸入:http://localhost/codeigniter/index.php/pages/view,我得到了以下錯誤:

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

localhost 7/27/2012 11:14:39 PM Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0

我發現.htaccess文件中的以下內容的E:\WEB D\xampp\htdocs\CodeIgniter_2.1.2\application路徑:

Deny from all

我完全是新的到CodeIgniter框架。有人可以幫我嗎?

+0

請在你的問題,整個錯誤消息。它不應該只是說「找不到對象」。 – Matt 2012-07-27 17:50:41

+0

文件和類是否都正確命名? – MasterGberry 2012-07-27 17:51:41

+0

某處有.htaccess文件嗎?如果是的話,你可以發佈它? – MasterGberry 2012-07-27 17:52:27

回答

6

好的,任何人想知道最終的解決方案是,目錄沒有正確命名。在創建本地服務器時,重要的是將文件的內容放在正確的文件夾中。

所以,如果你有http://localhost/codeigniter那麼目錄應該設置爲\path\to\webdirectory\root\codeigniter或在這種情況下:E:\WEBD\xampp\htdocs\codeigniter

0

確保你的PHP錯誤是可見的。

當我在關閉本地主機時嘗試爲代碼點火器設置base_url時,我也遇到了這個問題。我看了一下htaccess文件,檢查了mod_rewrite已打開,嘗試更改base_url,但都失敗了。

解決方案是確保環境設置爲主index.php文件中的開發並確保$ config ['log_threshold'] = 4;在config.php中設置。

之後,我的PHP錯誤出現了。我忘了爲新網站構建切換開發環境。

4

嘗試編輯您的.htaccess文件成了這個樣子下面,並把.htaccess文件在你的根應用程序文件夾

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

神像我的答案:D – Aditzu 2014-03-31 20:12:43