prevent访问PHP页面 [英] Prevent access to php pages

查看:145
本文介绍了prevent访问PHP页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,我已经设置的.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.

这篇关于prevent访问PHP页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆