1. In your MOSS server, make a copy of

%systemdrive%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033\sps404.html

and call it my404.html

2. Create a Virtual Directory in IIS under your MOSS root web application. For example /errors

3. Create your own redirect aspx page, for example /errors/my404redirect.aspx and code your redirect logic in there. This is a normal asp.net
page.

4. In my404.html, make the following change:

STSNavigate("/errors/my404redirect.aspx?oldUrl=" + requestedUrl);

5. Create a Console Application and insert the following code and run it in MOSS server

System.Uri webApplicationUri = new Uri(http://MyMOSSServer/);

SPWebApplication webApplication = SPWebApplication.Lookup(webApplicationUri);

webApplication.FileNotFoundPage = "my404.html";  //*note

webApplication.Update();

*Note: By default this is set to null. FileNotFoundPage needs to point to a html file that lives in %systemdrive%\Program Files\Common Files\Microsoft
Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033. The file needs to be html only.

6. Now when you browse to a page that doesn't exist, you should expect to be brought to the redirected page.

*Another note:

In IE there's a "Show friendly HTTP error messages" setting which is ON by default in Internet Options->Advanced. With this setting on, sometimes
your custom error page is not displayed. In order to override this setting, both my404.html and /errors/my404redirect.aspx from the above steps need to be larger than 512 bytes in size. Refer to the following KB about this setting: http://support.microsoft.com/kb/218155

* This seems to be working within a site collection context only, i.e.http://MyMOSSServer/sites/siteA if
sites is a wildcard inclusion managed path and siteA doesn't exist in MOSS then this URL will NOT trigger the custom 404 error page set to SPWebApplication.FileNotFoundPage property.

How to create your own custom 404 error page and handle redirect in SharePoint 分类: Sharepoint 2015-07-08 00:22 4人阅读 评论(0) 收藏的更多相关文章

  1. HTTP 错误 500.19- Internal Server Error 错误解决方法 分类: Windows服务器配置 2015-01-08 20:16 131人阅读 评论(0) 收藏

    1.第一种情况如下: 解决方法如下: 经过检查发现是由于先安装Framework组件,后安装iis的缘故,只需重新注册下Framework就可以了,具体步骤如下 1 打开运行,输入cmd进入到命令提示 ...

  2. 404错误 标签: servlet浏览器 2016-11-16 16:58 61人阅读 评论(0) 收藏

    404是资源没有找到,一般由于以下几个方面导致: 1.路径出错: a)检查web.xml中servlet的配置是否出错 b)浏览器访问是路径书写方式:http://localhost:8080/项目名 ...

  3. Android 应用中十大常见 UX 错误 分类: H1_ANDROID 2013-09-21 13:59 404人阅读 评论(0) 收藏

    转载自:http://www.apkbus.com/android-5661-1.html 摘要: Android 开发者关系团队每天都会试用无数的 App 或者受到无数的开发者发来的请求评测的 Ap ...

  4. Struts2 Handle 404 error page and wrong action

    1. To handle 404 not found yourself, just add this code to your web.xml <error-page> <error ...

  5. Handling HTTP 404 Error in ASP.NET Web API

            Introduction: Building modern HTTP/RESTful/RPC services has become very easy with the new AS ...

  6. 在ASP.NET Core使用Middleware模拟Custom Error Page功能

    一.使用场景 在传统的ASP.NET MVC中,我们可以使用HandleErrorAttribute特性来具体指定如何处理Action抛出的异常.只要某个Action设置了HandleErrorAtt ...

  7. Openning SharePoint - 80 website gives HTTP 404 Error, The webpage cannot be found ! on SharePoint 2013

    ask: I tried to open the SharePoint - 80 throw Browse in IIS, but I get HTTP 404 Error (The webpage ...

  8. [转]在ASP.NET Core使用Middleware模拟Custom Error Page功能

    本文转自:http://www.cnblogs.com/maxzhang1985/p/5974429.html 阅读目录 一.使用场景 二..NET Core实现 三.源代码 回到目录 一.使用场景 ...

  9. CREATE FILE encountered operating system error 5(Access is denied.)

    这篇博文主要演示"CREATE FILE encountered operating system error 5(Access is denied.)"错误如出现的原因(当然只是 ...

随机推荐

  1. python非递归全排列

    刚刚开始学习python,按照廖雪峰的网站看的,当前看到了函数这一节.结合数组操作,写了个非递归的全排列生成.原理是插入法,也就是在一个有n个元素的已有排列中,后加入的元素,依次在前,中,后的每一个位 ...

  2. Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) D. Santa Claus and a Palindrome STL

    D. Santa Claus and a Palindrome time limit per test 2 seconds memory limit per test 256 megabytes in ...

  3. sublime使用小技巧——自动保存后缀名与自动匹配语法

    1,打开sublime 2,新建文件 3,ctrl+shift+p 4,输入ss(set syntax),在下拉列表中选择需要的语言 列表很多,可以输入相关快捷键 如:html-->ssh cs ...

  4. rxjava源码分析

    RXjava响应式编程 此文作者大暴雨原创,转载请注明出处. 如果线程的知识不是很丰富,请先查看     rxjava源码中的线程知识  一文 rxjava总结就是:异步实现主要是通过扩展观察者模式 ...

  5. mysql mybatis-generator plugin 有page实体类的分页

    page实体类 package cn.zsmy.tmp; import java.io.Serializable; /** * 分页对象. * */public final class Page im ...

  6. 反射(Reflection)

    反射主要用于在程序运行期间动态解析相关类的类名,命名空间,属性,方法并进行相应操作,以下通过两个简单的例子进行了说明: 示例1:调用程序集内部方法,运行时动态获取相关类的信息,包括类名,命名空间等信息 ...

  7. SQL SERVER 分区

    “索引要与其基表对齐,并不需要与基表参与相同的命名分区函数.但是,索引和基表的分区函数在实质上必须相同,即: 1) 分区函数的参数具有相同的数据类型: 2) 分区函数定义了相同数目的分区: 3) 分区 ...

  8. ExtJS自制表格Grid分页条

    试过Grid自带的load和分页功能,没有成功,干脆就自己写了...... 主要是查询条件比较复杂...... 希望哪位大神能有更好的意见. Ext.define('MyApp.ux.Paginati ...

  9. SPSS数据分析—广义估计方程

    广义线性模型虽然很大程度上拓展了线性模型的应用范围,但是其还是有一些限制条件的,比如因变量要求独立,如果碰到重复测 量数据这种因变量不独立的情况,广义线性模型就不再适用了,此时我们需要使用的是广义估计 ...

  10. easyui datagrid 分页

    //初始化dategrid $('#tt').datagrid({ url:null, pagination:true, pageSize:, pageNumber:, rownumbers:true ...