Fix for Subtext 404 Page Not Found Errors In Multiple Blogs Scenario

Shiva

If you have installed more than one blog using the SubText Framework and followed the subtext 1.9.2.30 installation instructions step by step, the step 7 instructs you to # Configure the Custom 404 page. I accidentally missed this step when I installed multiple subtext blogs and later found that I was getting the HTTP 404 Page Not Found Error. A solution to this was provided by Steve Harman when he told me that the step 7 of the installation instruction should fix this problem. I tried that and found that it did, indeed, fix the problem. So now, when I browse to either of my 2 blogs, say http://theshiva.us/technicalblog/ or  http://theshiva.us/travelblog/ without the default.aspx extension, the default page of that blog is displayed.

However, while inspecting the live HTTP headers for this request, a friend and I identified a possible searchbot issue with this Custom 404 page redirect fix. The HTTP header show a 302 Found code, which implies “The requested resource resides temporarily under a different URI”.

subtext-01-404-page-not-found-redirect-302-code

So when a the bot – say googlebot -  visits the root of either of the 2 blogs, and gets this status code of 302, it may not index the page assuming that the page move is a temporary one. In turn, this means that since the bot refrained from indexing the main root page of the blog, the underlying posts may never get indexed – unless,  of course – there are inbound links to those pages from other website or blogs. The correct approach to the redirect would be to return a 301 status code which implies “The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs.”

Fix the Redirect Issues in Subtext’s 404 Page Not Found

The friend suggested a workaround / hack to fix the 404 Page Not Found errors without losing out on the bot indexing. I tried it and it works, so here it is.

First, rollback the step 7 instruction of the SubText installation for the 404 custom error page and set it back to what the original setting was.

Next, create physical folders for each of the many subtext blogs that you are hosting. For example, in my case, for the 2 blogs that I had originally created, I would create 2 physical folders by the name of technicalblog and travelblog under the root folder of my website http://theshiva.us/ on my host.

Finally, create a blank default.aspx file inside each of the folders you just created using any text editor, and add a line for the Page directive to it.

subtext-02-404-page-not-found-create-default-aspx-page

Although  – as you will realize later – a blank default.aspx file is sufficient, it is recommended that you add this line to the default.aspx file.

Now browse to the root URL of each of your blogs without using the default.aspx extension. For example, in my case, I would browse to http://theshiva.us/technicalblog/ or http://theshiva.us/travelblog/ and see that the HTTP headers look fine.

How did the Fix work ?

When IIS gets the request for the root blog URL (without the default.aspx in the URL), it looks to see if the folder exists, and if it has a default.aspx inside the folder, it passed the request to the subtext application to resolve the URL and handle the request. From there, the HTTPHandler of subtext gets the URL to resolve and redirect. So when we added the physical folder and the default.aspx file under that folder, the URL was passed on to the Subtext application which resolved it correctly.

subtext-02-404-page-not-found-200-OK-code

3 Comments For This Post

  1. Steve Harman Says:

    Shiva,
    Perhaps you could look into fixing the Subtext codebase to make sure that we send back the correct code… and then submit your fix as a patch… if you find some spare cycles that is. :)

  2. Shiva Says:

    Ok, I am doing my best to find spare time in this very busy year that is ahead of me !

  3. marcel gaudet Says:

    hi i’m having the 404 page not found error and i’m having problems getting on any site even if i’m lucky and it works. what can i do to fix it. can you help me im not very good with computers but if you can put it in simple terms i’ll try my best.
    thanks
    marcel

Leave a Reply

Advertise Here

Photos from our Flickr stream

See all photos

Advertise Here