2012-07-04 106 views
0

真的找不到我的錯誤,我可以訪問站點地圖/鏈接,但所有其他人提供404未找到錯誤。Apache htaccess文件,我哪裏出錯了?

DirectoryIndex index.php index.php?page=home index.php?page=error 
Options Indexes FollowSymLinks MultiViews 

AllowOverride All 
Order allow,deny 
Allow from all 

<IfModule mod_rewrite.c> 
    RewriteEngine On 

    # some other stuff # 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteBase/
    RewriteRule ^sitemap/?$ sitemap.xml.php [L] 
    RewriteRule ^([a-zA-Z]+)/?$ index.php?page=$1 [L] 
    RewriteRule ^products/?$ index.php?page=products [L] 
    RewriteRule ^products/([0-9]+)/?$ index.php?page=products&id=$1 [L] 
</IfModule> 

我真的很感激一些幫助,我在.htaccess文件絕對吸...

+0

檢查您的錯誤日誌 - 顯示什麼? –

+0

同一行一定次數:'[Wed Jul 04 02:56:30 2012] [error] [client 127.0.0.1]文件不存在:/ var/www/home「' –

+0

Then ...你確定問題在於你的.htaccess文件? –

回答

0

重寫規則之外,你在這裏有其他問題:

DirectoryIndex index.php index.php?page=home index.php?page=error 

這意味着, ,對於一個文件夾文件顯示索引將按此順序被選中(第一個現有勝利):

  1. index.php
  2. index.php?page=home(這是
  3. index.php?page=error(這是

我懷疑這是你的意圖。

下一頁:

AllowOverride All 

如果您在.htaccessAllowOverride是已經被限制,這會忍不住了,如果不是,那麼有沒有再次寫這點。

Order allow,deny 
Allow from all 

這基本上是說「允許任何人到處都是」,這是默認的反正。除非它在上層或apache配置中受到某種限制,否則這是多餘的。


至於重寫:

RewriteRule ^([a-zA-Z]+)/?$ index.php?page=$1 [L] 
RewriteRule ^products/?$ index.php?page=products [L] 

第二個規則是冗餘的,無論如何,並且永遠不會被達到(作爲第一之一匹配它)。


至於你看到的錯誤:

[Wed Jul 04 02:56:30 2012] [error] [client 127.0.0.1] File does not exist: /var/www/home" 

這可能意味着與DocumentRoot定義問題。請發佈您的VirtualHosts配置。