Only allow certain IP addresses to access site with mod_rewrite?

后端 未结 2 1070
小鲜肉
小鲜肉 2020-12-15 12:24

We have a directory on our site which we only want to be accessible by a couple of IP addresses. So we have this .htaccess file to try and get it working:

Re         


        
2条回答
  •  臣服心动
    2020-12-15 13:02

    I guess you should add [OR] modifier after each RewriteCond, like this:

    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 [OR]
    RewriteCond %{REMOTE_ADDR} !^124\.124\.124\.124 [OR]
    ...
    

提交回复
热议问题