【新疆】虛擬主機(jī)屏蔽IP地址的方法
發(fā)布時(shí)間:2018-09-17 16:26:03 作者:admin 點(diǎn)擊:
PHP
代碼如下
RewriteEngine on
RewriteBase /
Order Deny,Allow ## 拒絕開關(guān),allow表示拒絕訪問
Deny from 182.92.253.20 ##輸入要屏蔽的IP地址
Deny from 121.18.126 ## 屏蔽IP段
ASP
通過在首頁(yè)添加以下代碼實(shí)現(xiàn)
<%
requestIP = request.ServerVariables("REMOTE_ADDR")
IP = "127.0.0.1|192.168.1.1"
trueURL = "http://www.baidu.com"
falseURL = "http://www.google.com"
ipArr = split(IP,"|")
flag = false
for i=0 to ubound(ipArr)
if requestIP=ipArr(i) then
flag=true
exit for
end if
next
if flag then
response.Redirect(falseURL)
else
response.Redirect(trueURL)
end if
%>
JS通過以下方式禁止IP訪問
可以通過訪問新浪提供借口獲取IP地址歸屬地相關(guān)信息 :
http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=IP地址



通過 .htaccess文件屏蔽
IP代碼如下
RewriteEngine on
RewriteBase /
Order Deny,Allow ## 拒絕開關(guān),allow表示拒絕訪問
Deny from 182.92.253.20 ##輸入要屏蔽的IP地址
Deny from 121.18.126 ## 屏蔽IP段
ASP
通過在首頁(yè)添加以下代碼實(shí)現(xiàn)
<%
requestIP = request.ServerVariables("REMOTE_ADDR")
IP = "127.0.0.1|192.168.1.1"
trueURL = "http://www.baidu.com"
falseURL = "http://www.google.com"
ipArr = split(IP,"|")
flag = false
for i=0 to ubound(ipArr)
if requestIP=ipArr(i) then
flag=true
exit for
end if
next
if flag then
response.Redirect(falseURL)
else
response.Redirect(trueURL)
end if
%>
JS通過以下方式禁止IP訪問
可以通過訪問新浪提供借口獲取IP地址歸屬地相關(guān)信息 :
http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=IP地址



評(píng)論排行
- ·易優(yōu)cms小程序插件(76)
- ·微信小程序百度小程序記...(10)
- ·關(guān)于百度小程序微信小程...(2)
- ·電子圖書館網(wǎng)站(1)
- ·dedecms小程序插件最新升級(jí)日志(1)
- ·怎么選擇注冊(cè)有利于SEO優(yōu)...(0)
- ·網(wǎng)站文章內(nèi)容更新有哪些原則(0)
- ·修復(fù)list接口當(dāng)傳參more...(0)
- ·網(wǎng)站被惡意鏡像怎么辦 ...(0)
- ·已經(jīng)上線的小程序如何自...(0)
- ·網(wǎng)站建設(shè)是一門技術(shù)活 ...(0)
- ·企業(yè)網(wǎng)站建設(shè)的具體流程...(0)
- ·建議:請(qǐng)不要在工作中發(fā)...(0)
- ·移動(dòng)端網(wǎng)站建設(shè)將何去何從?(0)
- ·論企業(yè)網(wǎng)站建設(shè)的行業(yè)現(xiàn)狀(0)
- ·phpcms小程序插件api接口...(0)
相關(guān)欄目
閱讀排行
- 1小程序測(cè)試正常真機(jī)不顯示內(nèi)容問題處理(request:fail ssl hand shake error)
- 2網(wǎng)站被惡意鏡像怎么辦 一段代碼輕松搞定(全面版)
- 3phpcms開發(fā)小程序api插件1.2版本
- 4phpcms v9小程序demo內(nèi)容頁(yè)安卓有時(shí)候不顯示內(nèi)容bug修改
- 5虛擬主機(jī)屏蔽IP地址的方法
- 6阿里云備案詳細(xì)流程
- 7關(guān)于百度小程序微信小程序video標(biāo)簽不支持視頻封面autoplay等問題修復(fù)方法
- 8phpcms v9手機(jī)訪問電腦站一對(duì)一跳轉(zhuǎn)對(duì)應(yīng)手機(jī)站頁(yè)面插件
- 9FTP使用教程(以FlashFTP為例)
- 10網(wǎng)站安裝教程(phpcms v9程序)
更多+最新案例