我试图否认所有这些,并且只允许一个IP。但是,我希望有以下的htaccess为该单一的IP工作。我找不到一种方法来让这两个选项都起作用:拒绝所有和只允许一个,外加以下选项:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
有没有办法做到这一点呢?
发布于 2010-12-10 00:13:28
order deny,allow
deny from all
allow from <your ip>
发布于 2012-12-19 02:06:39
这可以通过使用为该任务设计的指令来改进。
ErrorDocument 403 /specific_page.html
Order Allow,Deny
Allow from 111.222.333.444
其中111.222.333.444是您的静态IP地址。
当使用"Order Allow,Deny“指令时,请求必须匹配Allow或Deny,如果两者都不满足,则请求被拒绝。
http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order
发布于 2012-05-18 21:35:43
对上面的版本稍作修改,包括向那些被拒绝访问的人显示的自定义页面:
ErrorDocument 403 /specific_page.html
order deny,allow
deny from all
allow from 111.222.333.444
以这种方式...and那些不是来自111.222.333.444的请求将看到specific_page.html
(这条评论看起来很糟糕,因为新的行会丢失)
https://stackoverflow.com/questions/4400154
复制相似问题