我以前用过js,判断是不是自己的域名,不是就跳转。至于从服务器层面禁止我就不会了

<script type="text/javascript">
if(location.toString().indexOf("xxx.com") <= -1)     /*如果当前网址中没有域名xxx.com*/ 
{ 
document.location.href="指定链接";   /*跳转到警示图片*/ 
} 
 </script>