.htaccess文件mod_rewrite中的IP范围 [英] IP range in .htaccess file mod_rewrite

查看:67
本文介绍了.htaccess文件mod_rewrite中的IP范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个,它不起作用:

I have this and it's not working:

RewriteEngine On
RewriteBase /igra/
RewriteCond %{HTTP_USER_AGENT} (safa|navigator) [NC]
RewriteCond %{REMOTE_ADDR} (78\.30\.128\.0/78\.30\.159\.255)
RewriteRule ^((?!templ/).*)$ templ/$1 [L,NC]

我相信下面是问题所在-IP范围是某个范围还是IP范围是什么?0/78部分

I belive somwhere below is problem - somewhere IP range is it / for IP range or what?0/78 part

RewriteCond %{REMOTE_ADDR} (78\.30\.128\.0/78\.30\.159\.255)


推荐答案

您不能在 mod_rewrite 中使用IP地址范围,但可以使用多个使用正则表达式OR(管道)的IP起始块如下:

You cannot use IP address range in mod_rewrite but you can use multiple IP starting blocks using regex OR (pipe) like this:

RewriteCond %{REMOTE_ADDR} ^78\.30\.(128|129)\.

或对此:

RewriteCond %{REMOTE_ADDR} ^78\.30\.12[89]\.

这篇关于.htaccess文件mod_rewrite中的IP范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆