2012-05-31 44 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] 

如果一切正常,你可以重新添加的意见(也许留在规则中的最后一个字符和符号#之间只有一个空格)。

相关问题