prevent访问PHP页面页面、prevent、PHP

2023-09-02 09:51:11 作者:你以为岔开双腿就是爱吗

好了,我已经设置的.htaccess像这样:

Ok, so I have set the .htaccess like so:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ index.php

因此​​,大家可以看到我解析一切的索引文件之外,因为我需要包括php的文件,还可以显示图像的。

so as you can see I'm parsing everything to index except files because I need to "include" the php files and also displaying of images.

如果用户键入例如www.site.com/login.php,将显示登录的PHP页面。

If users will type for example www.site.com/login.php that will show the login php page.

我如何prevent访问PHP页面也允许包括呢?

How do I prevent access to the php pages but also allow to "include" them?

推荐答案

将他们的文档根目录之外。它们可以安全地包括从那里,但不被访问过的网页。

Move them outside of your document root. They can be safely included from there but not accessed over the web.