根據要求:未取得備案號的網站禁止訪問! 經核實您的網站:“ XXX ”未備案成功…
有一個網站因為之前的備案號在北京,現在想轉到安徽這邊來,于是,就按流程先注銷備案,再重新備案。
為了搜索引擎的優化效果,網站不能關閉,于是,又購買了個香港空間臨時用一下。
萬萬沒想到,提交備案初審結果如下:
根據要求:未取得備案號的網站禁止訪問! 經核實您的網站:“ 安徽寶訊信息技術有限公司 ”未備案成功卻能訪問,請您暫時關閉網站,待備案成功后再打開。
這不是白買了個空間么!!!
錢花了就算了,可是,這樣下來,網站優化排名肯定是沒有了呀!
這個問題,難不倒我們的技術,現在就提供解決方案!
思路:
1. 先判斷訪問的是不是搜索引擎爬蟲;
2. 再判斷訪問的來源是不是搜索引擎?
如果都不是,提示網站關閉,否則,正常訪問!
' 是否搜索引擎爬蟲 Function is_bot() Dim user_agent,Re user_agent = lcase(Request.servervariables("Http_User_Agent")) Set Re = New Regexp Re.IgnoreCase = True Re.Global = True Re.Pattern = "(bot|crawl|spider|slurp|sohu-search|lycos|robozilla)" is_bot = Re.Test(user_agent) Set Re = Nothing End Function ' 是否通過搜索而來 Function is_search() Dim prv_url,Re prv_url = lcase(Request.ServerVariables("HTTP_REFERER")) Set Re = New Regexp Re.IgnoreCase = True Re.Global = True Re.Pattern = "(baidu|google|so|bing|sm|sogou)" is_search = Re.Test(prv_url) Set Re = Nothing End Function If is_bot = False And is_search() = False Then Response.write("<iframe style=""width:860px; height:500px;position:absolute;margin-left:-430px;margin-top:-250px;top:50%;left:50%;"" src=""http://batit.aliyun.com/alww.html"" frameborder=""0"" scrolling=""no""></iframe>") Response.End() End If
網站是早期ASP開發,上面的代碼僅供參考,如有更好的方法,歡迎交流!