我知道有可能重新定向 .taccess 基于IP,作为一种仪器
.taccess
Options +FollowSymlinks RewriteEngine on RewriteCond %{REMOTE_ADDR} !=123.45.67.89 RewriteRule index.php$ /construction.php [R=301,L]
但我要找的是基于IPs范围的重定向,我是说 123.45.67.89 to 123.45.67.120 95.4.63.0 to 95.4.63.200
123.45.67.89 to 123.45.67.120
95.4.63.0 to 95.4.63.200
如何重定向用户 .htaccess
.htaccess
您还可以使用regex检查数字范围。对于您的示例,以下规则应该适用:
RewriteEngine On RewriteCond %{REMOTE_ADDR} ^123\.45\.67\.(89|9\d|1[01]\d|120)$ [OR] RewriteCond %{REMOTE_ADDR} ^95\.4\.63\.(\d|[1-9]\d|1\d{2}|200)$ RewriteRule ^index\.php$ /construction.php [R=301,NC,L]