苏苏网赚论坛

 找回密码
 立即注册
查看: 6100|回复: 0

不同的情况下设置404页面的方**

[复制链接]
跳转到指定楼层
楼主
发表于 2018-12-7 01:34:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  2、Apache服务器下设置404错误页面
  在.htaccess 文件中加入代码: ErrorDocument 404 /Error.html,建立一个简单的html404页面命名 Error.html把 Error.html放置在网站根目录。
  注意:
  不要将404错误直接转向到网站首页,这将导致首页不被收录;/Error.html 前面不要带主域名,否者返回的状态码是302或200状态码。
  3、IIS/ASP.net下设置404错误页面
  首先,修改应用程序根目录的设置,打开 web.config 文件编辑,在其中加入如下内容:
  <configuration>
  <system.web>
  <customErrors mode=On defaultRedirect=error.asp>
  <error statusCode=404 redirect=notfound.asp />
  </customErrors>
  </system.web>
  </configuration>  
  注:上文例中error.asp为系统默认的404页面,notfound.asp为自定义的404页面,使用时请修改相应文件名。
  然后,在自定义的404页面notfound.asp中加入:
  然后,在自定义的404页面notfound.asp中加入:
  <%
  Resp**e.Status = 404 Not Found
  %>
热帖推荐
回复

使用道具 举报

广告合作|最大的网赚客中文交流社区!十年老站!

GMT+8, 2024-5-11 16:34 , Processed in 0.124801 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.1 VIP版

© 2012-2022 苏苏网赚论坛 版权所有 | 10年老品牌

快速回复 返回顶部 返回列表