Is the best place set the 404 error page for SharePoint within the web.config customError section or is there a configuration setting on the site collection/ web application?
Hi,
please have a read at this blog
pasted:
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
Create a Virtual Directory in IIS under your MOSS root web application. For example /errors
- 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.
- In my404.html, make the following change: STSNavigate("/errors/my404redirect.aspx?oldUrl=" + requestedUrl);
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"; webApplication.Update();
Now when you browse to a page that doesn't exist, you should expect to be brought to the redirected page.
I know this has already been answered but an alternative mgith be the following url: http://sharepointsmart404.codeplex.com/ - which should still result in a 404 status code so that search engines remove the page from their cache (eventually)