Custom 404 Page

As I underhand, to help with the SEO of a website what you call the name of your file carries some weight.  So it is important to name your files something like custom-lanyards rather than products.aspx?categID=105.  To accomplish this what I’ve elected to do is write a custom 404 error page.  The first piece is the SQL table, one of the item’s unique attributes is the page file name.  When the page that doesn’t exist then loads, the server calls my custom 404 page which then looks up in the database weather the filename exists or not.  If it exists, I use the Server.Transfer function to load ItemPage.aspx?id=XXX where XXX is the item’s actual ID.  Doing this i’m able to create page names like wholesale-lanyards, custom-printed-lanyards, red-blank-lanyards etc which then all call the same page on the back-end and dynamically get their content from SQL.

I’m also able to use another SQL table that 301 redirects old pages that google may have indexed to the new page without actually having to keep the page.  This has allowed me to correct the site structure without damaging the SEO value for some of our websites.

Finally when I don’t want to redirect the page i have a nice user friendly page display an error message that lets the user know the page doesn’t exist and links back to the home page.

Setting it up in IIS is pretty simple, you just go into the properties and point to 404 page to your custom page and then you’re done!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>