设置网站404页面方法

     一个网站的404页面很重要,当发的信息失效或者删除时候,仍有一些链接被搜索引擎搜到,这样当用户访问的时候加上404页面将用户带到网站首页是常用的方法。
   
404页面的正确做法
1、Apache服务器404页面的设置方法
在.htaccess 文件中加入代码:ErrorDocument 404 /404.htm,建立一个简单的html404页面命名 404.htm,把 404r.html放置在网站根目录即可。
 
我的网站代码是这样写的
< html > 

< head > 
< meta  http-equiv ="Content-Language"  content ="zh-cn" > 
< meta  http-equiv ="Content-Type"  content ="text/html; charset=gb2312" > 
< title >404你访问的页面不存在mlhd.org  </title> 

< body  bgcolor ="#336600" > 

< script  language ="javascript"  type ="text/javascript" >    
setTimeout("location.href=' /index.php'", 5000);    
</script> 

< p  align ="center" > 
< a  href ="http://www.mlhd.org" > < font  color ="#00FFFF"  face ="仿宋_GB2312" >进入网站首页 </font> </a> < font  color ="#00FFFF" >>>> </font> </p> 
< p  align ="center" > < font  color ="#FFFF00" >你访问的页面不存在,或已经被删除,谢谢光临邯郸生活网 </font> </p> < EMBED src=http://adamcheng.cn/yy/%CC%EC%B4%F3%B5%D8%B4%F3.wma width=0 height=0 type=audio/x-pn-realaudio-plugin  controls ="ControlPanel,StatusBar"  AutoStart ="true"  Loop ="false" > 

< div  style =" visibility:hidden;" > 
( < script  language ="javascript"  type ="text/javascript"  src ="http://mlhd.org/tools/js/tongji.js" > </script>) </div> </body> 

</html>

特别提示:404页面的转向的网站首页不要加自己的域名 若加上容易导致首页收录有问题 正确应该这样写 /indx.php  别加网站域名



本文转自 yeybz 51CTO博客,原文链接:http://blog.51cto.com/hmlwl/1151988

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值