本文介绍了如何从php文件中禁止URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有让URL禁止从php文件访问而没有触摸(配置)webserver ??

Is there anyway to make URL forbidden to access from php file without "touching" (configure) the webserver??

推荐答案

<Files forbiddenfile.php>
Order Deny,Allow
Deny from All
</Files>

ErrorDocument 403 /ErrorPages/403.php



如果您发现这是配置服务器,您还可以将用户重定向到403页面访问 forbiddenfile.php


If you find that this is configuring the server, you can also redirect the user to the 403 page if he tries to access forbiddenfile.php:

<?php
header('Location: /ErrorPages/403.php'); // add this PHP code at the top of your PHP file
?>  



希望这会有所帮助。


Hope this helps.


这篇关于如何从php文件中禁止URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 16:13