2012-05-31 66 views
1

我已經請求的URL的 「http:// MYDOMAIN/testscripts/php_Env」爲什麼下面的apache htaccess代碼不會返回我的頁面?

我在testscripts文件夾中的文件php_Env.php ..

我htaccess的是如下

RewriteEngine On # Turn on the rewriting engine 
RewriteCond %{REQUEST_FILENAME} !-f # Existing File 
RewriteCond %{REQUEST_FILENAME} !-d # Existing Directory 
RewriteRule ^(php_([a-zA-Z_]+))$ $1.php [NC,L] 

當運行它,瀏覽器返回我

Internal Server Error 

The server encountered an internal error or misconfiguration and was unable to complete your request. 

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. 

More information about this error may be available in the server error log 

什麼,我想要做的是如果請求的文件是不是一個目錄,而不是一個文件,要求文件。我在哪裏出錯在htaccess中?

+0

你可以檢查服務器日誌嗎?你也想在你的規則之前加上'RewriteBase/testscripts /'。 – Ansari

+0

仍給我同樣的錯誤 –

+0

什麼是錯誤?檢查你的日誌 - 500錯誤將有一個原因。 – Ansari

回答

1

嘗試沒有多餘的空格和註釋:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(php_([a-zA-Z_]+))$ $1.php [NC,L] 

如果一切正常,你可以重新添加的意見(也許留在規則中的最後一個字符和符號#之間只有一個空格)。

相關問題