Forum Moderators: open

Message Too Old, No Replies

Google Site Map failure with custom 404 for friendly URLs

         

adcworks

7:25 pm on Mar 13, 2006 (gmt 0)

10+ Year Member



Hi,

As many have suggested, a neat way to achieve friendly URLs in the ASP.net environment is to leverage IIS's custom 404 page.

I configured my IIS 404 to point to Catalog404.aspx. The code behind for that aspx contains roughly

Response.StatusCode = 200;
path = path.Substring(idxCat);
Context.Items["catPath"] = path;
Server.Transfer("Catalog.aspx");

Don't worry too much about the path stuff, essentially I am taking off the friendly part of the URL and adding it in a variable before transferring to the real Catalog.aspx which then uses that path to match up the page in the DB.

The problem is that I tried to do a Google site map the other day and Google is detecting that I am using a 404 mechanism on the site. As such it tells me I cannot authorise a site map that I place in my site root - some kind of security problem.

My question then is can I get around this or will I have to dump the 404 method in favour of something like HttpContext.RewritePath to get Google site maps working?

buckworks

7:34 pm on Mar 13, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You need to make sure your custom error page returns a proper 404 header. If you're returning a 200 OK, Sitemaps won't verify your site.

I encountered this a few days ago with a client's site. Once the techie guy made sure the custom error routine was sending the right signals, Sitemaps verified the site with no more problems.

adcworks

7:47 pm on Mar 13, 2006 (gmt 0)

10+ Year Member



I see, but would sending a 404 for a whole bunch of friendly URLs that represent a product catalog not tell Google there was nothing to index?

buckworks

7:56 pm on Mar 13, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You don't want to send a 404 for redirect pages, only for errors.

If I say too much more I'll be getting out of my depth, technically. Someone else will have to help with how to do it.

adcworks

8:23 pm on Mar 13, 2006 (gmt 0)

10+ Year Member



It was a 404 not for an error but for handling paths that did not exist to map onto database page rows.

Well, I've changed my strategy to use HttpContext.RewritePath which if anything seems a little quicker.

Thanks anyhow, appreciate it

ADC.