Mike Irving - Macclesfield Web Developer

Custom 404 Files, using ASP or .Net

Mike Irving - Macclesfield Web Developer image 1 Mike Irving - Macclesfield Web Developer image 2

News Section - Custom 404 Files, using ASP or .Net

Developer Blog from Mike Irving - Custom 404 Files, using ASP or .Net

22/7/2008 - Custom 404 Files, using ASP or .Net

Many web developers setup Custom 404 Files on their Websites to present a user-friendly alternative to the browser's own "File Not Found" page, however we can do a whole lot more when we start scripting within our 404 file.

We can perform 301 Redirects from old page names, to new ones, useful for SEO purposes.

We can serve a non-physical robots.txt file dependant on the HOST name. this is useful if your web server serves your site on multiple domains. You will only want Google and Search Engines to crawl one of the domains, to avoid duplicate content issues, so using the 404 page we can deliver either a Spiderable Robots file, or otherwise, dependant on the domain.

We would chnage the page Content Type to "text/plain" and the Status Code to "200" / OK in or robots.txt case.

We can also use the 404 file for simple URL Rewriting. A list of URL Rewrites can be handled in the 404 file, and a page can be delivered for each, as desired. In this case, we would change the page Status code to 200/OK on delivery, as opposed to 404/Not Found.

All of the above can be achieved easily using ASP or ASP.Net, or indeed any other scripting language.

You will need to setup the Custom 404 functionality on your web server, or with your hosting company. This can either be done direct in IIS, or is usually a setting available in your Web Hosting provider's control panel.

Page Not Found files can offer much more than meets the eye!


View Blog Entries - Page: 1, 2, 3, 4, 5, 6
Previous Blog Entries
01
Jul
2008
AJAX in Classic ASP websites
For a while now I've been writing AJAX-Enabled ASP.Net 2.0 Web Applications in Visual Studio 2005, but last week I got the opportunity to add some new functionality to a website that used AJAX in ASP....

Read This Blog Entry
08
Jun
2008
Working Remotely and Virtually
In today's increasingly networked world, the internet provides many ways of working both remotely and virtually. When at a remote location, we can take advantage of VPN technologies, Remote Desktop...

Read This Blog Entry
05
Jun
2008
How to configure IIS Websites in Visual Studio 2005 on Vista
Earlier this week I tried importing a Local IIS website in Visual Studio 2005 on my new Windows Vista PC. Interestingly, if I clicked "Open Website" then clicked the "Local IIS" option, I received ...

Read This Blog Entry
View All Blog Entries

Mike Irving (mikeirvingweb) on Twitter
My latest Tweet on Twitter...

Follow Me on Twitter

Bookmark this web page:
© 2010 Mike Irving Web Design Macclesfield