代码之家  ›  专栏  ›  技术社区  ›  Aaron Powell

SharePoint 404页

  •  5
  • Aaron Powell  · 技术社区  · 16 年前

    最佳位置是在web.config customerrror部分中为SharePoint设置404错误页,还是在网站集/web应用程序上有配置设置?

    2 回复  |  直到 14 年前
        1
  •  4
  •   Ric Tokyo    16 年前

    请阅读 this blog

    粘贴:

    1. 在您的moss服务器中,复制 %systemdrive%\program files\common files\microsoft shared\web server extensions\12\template\layouts\1033\sps404.html 并称之为my404.html

    2. 在您的moss根web应用程序下的IIS中创建一个虚拟目录。例如/错误

    3. 创建自己的重定向aspx页面,例如/errors/my404redirect.aspx,并在其中编写重定向逻辑代码。这是一个普通的ASP.NET页。
    4. 在my404.html中,进行以下更改: stsnavigate(“/errors/my404redirect.aspx”)。oldurl=“+请求URL);
    5. 创建一个控制台应用程序并插入以下代码并在moss服务器中运行它

      system.uri webapplicationuri=新的uri( http://MyMOSSServer/ ; spwebapplication webapplication=spwebapplication.lookup(webapplicationUri); webapplication.filenotfoundpage=“my404.html”; webapplication.update();

    6. 现在,当您浏览到一个不存在的页面时,您应该期望被带到重定向的页面。

        2
  •  1
  •   Mauro    14 年前

    我知道已经回答了这个问题,但另一个选择是下面的网址: http://sharepointsmart404.codeplex.com/ -这仍然会导致404状态代码,以便搜索引擎从缓存中删除页面(最终)