拒绝所有,只允许一个IP通过htaccess的只允许、IP、htaccess

2023-09-02 00:19:21 作者:凌驾风云之御姐

我想拒绝所有,只允许一个单一的IP。但是,我想有以下htaccess的工作是单一的IP。我没有找到一种方法,有两种工作方式:全部拒绝,并只允许一个,再加上以下选项:

 < IfModule mod_rewrite.c>
    RewriteEngine叙述上
    的RewriteBase /

    #Removes用户访问到系统文件夹。
    #Additionally这将允许您创建一个System.php控制器,
    #previously这将是不可能。
    #'系统'可以,如果你已重命名系统文件夹进行更换。
    的RewriteCond%{REQUEST_URI} ^系统。*
    重写规则^(。*)$ /index.php?/$1 [L]

    #当你的应用程序文件夹没有在系统文件夹
    #这个片断prevents用户到应用程序文件夹的访问
    Fabdrol:由#Submitted
    #Rename'应用'为您的应用程序文件夹名称。
    的RewriteCond%{REQUEST_URI} ^应用。*
    重写规则^(。*)$ /index.php?/$1 [L]

    #Checks,查看是否用户正在试图访问一个有效的文件,
    #such作为图像或CSS文档,如果这不是它发送的真实
    #request的index.php
    的RewriteCond%{} REQUEST_FILENAME!-f
    的RewriteCond%{} REQUEST_FILENAME!-d
    重写规则^(。*)$的index.php?/ $ 1 [L]
< / IfModule>

<!IfModule mod_rewrite.c>
    #如果我们没有mod_rewrite的安装,所有404的
    #可以被发送到index.php,一切工作正常。
    #提交者:ElliotHaughin

    的ErrorDocument 404的index.php
< / IfModule>
 

有没有一种方法,使这项工作?

解决方案

 为了否认,允许
所有否认
允许从111.222.333.444
 

苹果手机有隐藏id是什么回事

I'm trying to deny all and allow only for a single IP. But, I would like to have the following htaccess working for that single IP. I'm not finding a way to have both working: the deny all and allow only one, plus the following options:

<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>

Is there a way to make this work?

解决方案

order deny,allow
deny from all
allow from 111.222.333.444