阻止特定的文件扩展名与htaccess的?文件扩展名、htaccess

由网友(不会指南的针)分享简介:我用这code发送所有的请求到一个php文件:I am using this code to send all the request to a single php file:RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{RE...

我用这code发送所有的请求到一个php文件:

I am using this code to send all the request to a single php file:

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

但现在我也想阻止的直接进入以myfile.php等PHPS。我不希望PHP文件,直接通过浏览器打开,但他们必须合作,包括与这样的。

But now I want to also block direct access to myfile.php and other phps. I don't want the php files to open directly via browser, but they must work for includes and such.

我怎样才能做到这一点?

How can I do this?

推荐答案

也许这将有所帮助:

RewriteCond %{REQUEST_URI} !(.*).php$ [NC]
RewriteRule ^.* - [F,L]

有几个很好的例子在这里: Apache的维基:的RewriteCond

Several nice examples are here: Apache wiki: RewriteCond

阅读全文

相关推荐

最新文章