我想将所有不需要的请求页面重定向到一个 url
我每天在我的服务器上批量收到 example.com/garbage-value 请求,例如 2000+ 请求中没有用户代理,它显示在分析中
所以我想阻止他们,我认为可能的方法是重定向他们。
该网站是用asp制作的
我们可以用 asp 或 javascript 实现还是有其他方法可以实现。
我在想这样的事情,但没有奏效
//For an iPhone/iPod site:
if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) {
document.location = "http://URL.com/iphone/";
}
----------------------------------------
//For an iPad site:
if ( (navigator.userAgent.indexOf('iPad') != -1)) {
document.location = "http://URL.com/ipad/";
}