2011-04-07 51 views
0

我有這樣的網站在.htaccess奇怪htaccess的問題

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

#DirectoryIndex index.php 

我的問題是,即使,如果我改變一個字母的網站正在呈現一個500錯誤。即使我清空完整的文件,它仍然顯示我500錯誤。

我想要做的是,有這樣一個頁面上的文件generate.php/brochure/目錄確實存在域
http://www.example.co.uk/brochure/generate.php

但仍然generate.php不加載,它正在加載index.php文件。

任何幫助?

+0

檢查你的apache錯誤日誌,它可能包含有價值的線索。 – TJHeuvel 2011-04-07 09:08:08

回答

3

嘗試,我知道應該工作如下:

<IfModule mod_rewrite.c> 
    #Turn the Rewrite Engine ON 
    RewriteEngine On 

    #Set the base where to rewrite the requests 
    RewriteBase/

    #Allow direct file access 
    RewriteCond %{REQUEST_FILENAME} !-f 

    #Allow direct directory access 
    RewriteCond %{REQUEST_FILENAME} !-d 

    #Disallow certain files. 
    RewriteCond %{REQUEST_FILENAME} !brochure\/generate\.php$ 

    #Rewrite URLS To GET[menu] and make sure this is the last rule. 
    RewriteRule ^(.*)$ index.php?menu=$1 [L] 
</IfModule> 

,如果你沒有看到那麼任何重寫服用。安迪檢查,看看安裝了重寫模塊。

+0

嘿羅伯特,我的觀點是,它正在重寫'brochure/generate.php'到'index.php',我不想這麼做。我如何排除? – 2011-04-07 09:19:49

+0

添加了該行。 – RobertPitt 2011-04-07 09:25:36

+0

不起作用。現在這應該是與mod_rewrite正確的問題? – 2011-04-07 09:39:36

0

如果文件觸發了500個狀態碼好,那麼錯誤是別的地方:你是不是編輯真正.htaccess文件正在使用Apache的,誤差來源於應用等

無論如何,你應該找到錯誤日誌:這是確切的細節顯示的地方。在Linux中,它通常在/var/log/httpd之下。在Windows中,它可以在%ProgramFiles%\Apache Software Foundation\Apache2.2\logs之下。如果它是共享的託管帳戶,那麼您的控制檯中可能會出現「錯誤」或「日誌」功能。

+0

空的.htaccess文件觸發錯誤,因爲我的.htaccess文件沒有。這不奇怪嗎?另外,當我看到Cpanel錯誤日誌時,它是空的。 – 2011-04-07 09:21:22