我想以这样的方式限制整个站点,即只有两个IP可以进入该站点.我的.htaccess(站点的根目录)中有以下内容:
ErrorDocument 403 http://www.example.com/views/error403.html
Order Deny,Allow
Deny from all
Allow from 311.311.311 322.322.322.322
ErrorDocument 404 /views/error404.html
ErrorDocument 500 views/error500.html
Run Code Online (Sandbox Code Playgroud)
(显然,这些都是伪造的IP,在我的.htaccess中它们是正确的IP)
正如你所看到的,我只允许322.322.322.322和311.311.311.0/24的所有IP,并拒绝其他人.我想要的是,当任何人从另一个IP进入该网站时,他将查看error403.html页面.
过滤器工作正常,但不是重定向.当我尝试从拒绝IP进入网站时,我看到一条Apache消息:
Found
The document has moved here
Run Code Online (Sandbox Code Playgroud)
其中"here"是error403.html的链接.
我想我甚至限制了error403.html页面.
我该怎么做这个限制,但允许查看错误页面?我应该将error403.html页面移动到另一个目录(即/ views/error /)并将其他.htaccess放入其中,在该文件中允许所有IP吗?
先感谢您!
我有一个PHP网站,有多个PHP脚本.我需要从另一个站点向用户提供有限访问权限的用户.我想限制这些ppl可以访问的页面.
我这样做的方式如下:
// $_SESSION['systemid'] is set with a value of say, '1'
$permissionArray = $objACCESS->getPermissions($_SESSION['systemid']);
// getPermissions returns an array like the following (for that systemid):
// 0 => {'systemid' => '1', 'permission_type' => 'createcontent' }
// 1 => {'systemid' => '1', 'permission_type' => 'invitecontacts' }
// the following contain a list of script names that should be
// restricted if permission is not allowed
$createcontent = array('createcontent.php');
$managecontent = array('managecontent.php');
$invitecontacts = array('invitecontacts.php');
$page_name=basename($_SERVER["SCRIPT_FILENAME"]);
if(is_array($permissionarray))
{
$haspermissions = false; …Run Code Online (Sandbox Code Playgroud)