【发布时间】:2015-07-14 16:19:59
【问题描述】:
如何使用 htaccess 阻止对绝对 URL 的所有访问(三个 IP 除外)?
示例数据: http://subdomain.example.com/url/i/want/to/block IP: 10.10.10.10 10.10.10.11 10.10.10.12
这是我的代码:
RewriteCond %{REQUEST_URI} http://subdomain.example.com/url/i/want/to/block
RewriteCond %{REMOTE_ADDR} !=10.10.10.10
RewriteCond %{REMOTE_ADDR} !=10.10.10.11
RewriteCond %{REMOTE_ADDR} !=10.10.10.12
RewriteRule ^.*$ /index.php [R=302,L]
它不工作。我正在使用任何 IP 访问 URL。
【问题讨论】:
标签: regex apache .htaccess mod-rewrite