2015-12-15 33 views
0

WAMP一直在表現奇怪的我,我不明白爲什麼?對WAMP的新手使其變得更加困難。我一直在問一些關於在Windows 10上部署Codeigniter項目到WAMP安裝程序所面臨的問題的問題。我將留下鏈接到我的其他帖子,這些帖子在最後還沒有解決,也許這些信息可以幫助別人瞭解正在發生的事情。Codeigniter + WAMP只有主頁加載狀態代碼200 OK

目前的情況是,當我加載除主頁以外的本地項目(網站)的任何頁面並檢查螢火蟲的net標籤時,它顯示錯誤404,但該頁面確實在瀏覽器視圖中加載。儘管POST請求不像應該那樣工作,但您可以看到我的其他問題。

發生了什麼事?

Strange behaviour, WAMP - Codeigniter

WAMP Mysqli not working whereas Mysql works

WAMP and mysqli::real_connect(): (HY000/2002)?

一些詳細信息:

項目的.htaccess

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


<Files "index.php"> 
AcceptPathInfo On 
</Files> 
</IfModule> 

<IfModule !mod_rewrite.c> 

ErrorDocument 404 /index.php 
</IfModule> 

主機文件

127.0.0.1  localhost 
::1    localhost 

127.0.0.1  myProject 
::1    myProject 

虛擬主機

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "c:/wamp/www" 
    ServerName localhost 
    ServerAlias localhost 
    <Directory "c:/wamp/www"> 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require local 
    </Directory> 
</VirtualHost> 

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "c:/wamp/www/myProject/www" 
    ServerName myProject 
    ServerAlias myProject 
    ErrorLog "logs/myProject-error.log" 
    CustomLog "logs/myProject-access.log" common 
    <Directory "c:/wamp/www/myProject/www"> 
     Options Indexes FollowSymLinks 
     AllowOverride All 
     Require local 
    </Directory> 
</VirtualHost> 
+1

只有你的主頁工作表明你沒有配置所需的重寫。我假設codeigniter需要將所有請求重定向到index.php(大多數其他php框架都需要這樣做)。這可能是。 – Pavlin

+0

_it顯示錯誤404_反對獲取哪些資源 – RiggsFolly

+0

@RiggsFolly反對主網站。例如,url = Get Signup,status = 404 Not Found,Domain = myProject,其中註冊是我正在測試的頁面,url是http:// myProject/Signup。其他資源正在加載。我有更多的信息更新我的問題,請看看。 – StudentX

回答

0

這是一個重寫的問題。

在你的項目的根目錄,打開你的.htaccess並將其粘貼: (這是一個基本配置)

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

如果它的工作,定製適合您的需求。

希望它能起作用。

編輯:

也許與你使用的鏈接有問題:

嘗試使用:.../index.php文件/ yourController/MethodOfController

或者沒有指數相同。 php的鏈接

+0

嘿,它沒有工作。我已經更新了我現在爲該項目提供的.htaccess的問題,請看看。 – StudentX