WordPress 3.0.4 IIS redirect error in Google Webmaster Tools

For the last few months I’ve had a problem with Google Webmaster Tools complaining that I have pages that it can’t fetch.

Crawl errors
Crawl errors

Previously I had Not Found errors for pages Google had crawled before I got my permalinks sorted after moving hosts. For those issues I placed mod-rewrite rules in my .htaccess like so:

\# Fix broken links that Google remembers and tries to follow now and then
RewriteRule ^blog/2007/07/17/topcoder-single-round-match-257/ /blog/2005/08/09/topcoder-single-round-match-257/ [R=301,L]

But for the pages Google currently reports as getting 404’s my web-browser redirects correctly. So I used the Fetch as Googlebot lab tool and got 404’s

HTTP/1.1 404 Not Found
Date: Tue, 25 Jan 2011 18:25:58 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET,PHP/5.2.14
X-Pingback: https://simeonpilgrim.com/blog/xmlrpc.php
Content-Type: text/html; charset=UTF-8
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified: Tue, 25 Jan 2011 18:25:58 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Refresh: 0;url=https://simeonpilgrim.com/blog/2005/08/04/curse-of-the-azure-bonds-project/
Content-Length: 0

So I can see why the browser works, it’s following the Refresh, to show the 404 page, but the real page is shown, and no-one is the wiser, but Google doesn’t like that.

I started thinking it might be a problem with the ISS mod_rewrite plug-in used, but it has been working for ages. After reading pages about HTML redirecting and started to suspect WordPress, after realizing that the error pages where pages that I had renamed the permalink, so I went digging in the code, and found this:

//wp-includes/pluggable.php
function wp_redirect($location, $status = 302) {
  global $is_IIS;

  $location = apply_filters('wp_redirect', $location, $status);
  $status = apply_filters('wp_redirect_status', $status, $location);

  if ( !$location ) // allows the wp_redirect filter to cancel a redirect
    return false;

   $location = wp_sanitize_redirect($location);

  if ( $is_IIS ) {
    header("Refresh: 0;url=$location");
  } else {
    if ( php_sapi_name() != 'cgi-fcgi' )
      status_header($status); // This causes problems on IIS and some FastCGI setups
    header("Location: $location", true, $status);
  }
}

so I commented out the ISS check:

//simeon
//if ( $is_IIS ) {
// header("Refresh: 0;url=$location");
//} else {
if ( php_sapi_name() != 'cgi-fcgi' )
  status_header($status); // This causes problems on IIS and some FastCGI setups
header("Location: $location", true, $status);
//}

and the page still load for me, so tested with Fetch as Googlebot and now Googlebot is happy!

HTTP/1.1 301 Moved Permanently
Date: Tue, 25 Jan 2011 18:51:18 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET,PHP/5.2.14
X-Pingback: https://simeonpilgrim.com/blog/xmlrpc.php
Content-Type: text/html; charset=UTF-8
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified: Tue, 25 Jan 2011 18:51:18 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Location: https://simeonpilgrim.com/blog/2005/08/04/curse-of-the-azure-bonds-project/
Content-Length: 0

So not sure what problems WordPress users have on IIS, and hope I’ve not opened a can of worms, but for now this is just another customisation to keep track of.

Blog Customisations

I noticing that a few changes I made to my blog UI had been lost by upgrading theme’s and base WordPress code. Argg, I must remember to merge stuff when upgrading. I previously had my own theme to help handle this as I’d changed a lot of things about the default 2.x theme.

So this is mainly a note for myself, to help the future me locate and fix pet peeves.

To remove the annoying “continue reading” excerpts from Category/Tag views:
wp-content/themes/twentyten/loop.php line:132

<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>

to:

<?php if ( is_search() ) : // Only display excerpts for archives and search. ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>

and remove all the comment formatting junk that nobody uses and that clutters the Google Webmaster Tools site keywords tool:
wp-includes/comment-template.php line:1539

'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
'id_form' => 'commentform',

to:

'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '<p class="form-allowed-tags">' . __( 'You may use a subset of HTML tags and attributes' ) . '</p>',
'id_form' => 'commentform',

MacBook upgrades

A few months back we upgrade from 1GB to 4GB of memory in the MacBook. Two weeks ago I upgraded from Leopard to Snow Leopard, wow it has a smaller foot print, it also just works better and runs 64bit, I didn’t even know the MacBook was a 64bit CPU. This weekend I upgraded the hard disk from 80GB to a 320GB disk. Wow lots of space again.

Wow tech hardware is so cheap here in the USA, and upgrading the MacBook was so simple, I’m a little shocked I didn’t do it earlier.

Now I just just need to hurry up with an idea and build an iPod/iPhone app.

SSI Game Tools

Found a few weeks ago a developer working on a Player Character Editor for Pool of Radiance and for Curse of the Azure Bonds. Not sure that he’s released it, I assume he will at some point.

Bill’s Gold Box Explorer is awaiting a release any day now, but the latest code renders all graphics from the SSI Games. I did release a beta build on FRUA Hacking UA list.

I also got an email from Patrik saying he’s working on a port of Pool of Radiance in C++/GTK, so will link once that goes public.

Meat Pies

The family and I have been in New Zealand for almost two weeks and the highlights for me so far have been fish’n’chips and mince and cheese pies.

Here’s a photo of the later for your enjoyment:

nz mince and cheese pie
nz mince and cheese pie

Extra meat pie information for those non-kiwi or ozzie readers

Sim in the City

Wall Street Bull
Wall Street Bull
The new WTC tower
The new WTC tower
Road works
Road works
NYPD
NYPD

Here are four pictures from my walking trip around NYC last night. There were quite a few NYPD cars around, and a number of barricaded buildings. The New York Stock Exchange was one that had high security. It was quite surreal to turn off Broadway on to Wall Street. After walking down Broadway for a while I came across a building that had the most barricades, which I later found out was the FBI building. Weirdest part was one van parked near police car on Broad St. had signing that was like “Acme Bomb Handling” I was so dumb struck by it, I kept walking and didn’t take a photo.

I walked for a few hours, covering 3.4 miles (5.5KM) and was quite cold by the end of all.

Bad Weather = Cancelled Flights

Due to Blizzard Warnings, wild winds and snow all United flights out of Peoria today are cancelled.

Bad Weather
Bad Weather

Argg this is exactly what I didn’t want to happen on the return trip flights. I’m rescheduled for flights tomorrow but am hoping to getting earlier flights, otherwise all of Monday will be lost.

Orbitz for Business has the worst hold “music”, I hesitate to call it hold music, as it’s just silence, with every 20 seconds a computerised voice telling you that your still on hold, and thanking you for holding, and asking you remain on the line, and that Orbitz values my customer ship, and lots more brown noising noises. Just play some tacky music, and stop talking, or hire more phone call workers.

Anyway, no earlier flights so I’m just missing the first of three days…

Well at least that saves one day of small talk about the weather, etc. ;-)

Halo 3: ODST

Halo 3 ODST
Halo 3 ODST

As my first introduction to the Halo world, Halo 3: ODST was awesome fun. I brought it second hand so the short length campaign play was not too disappointing, but I really enjoyed the dark stalking around the city, searching for clues, and then the more action orientated sub-missions to complete the plot. Very enjoyable.

I really struggled with using the controller to move and shoot, compared to mouse and keyboard combo, as said previously, all the buttons are on the wrong side of the controller once you switch the look and move sticks.

After completing the game, and doing a few levels with some skulls turned on, I tried the online multi-player mode. Very fun, but very much more intense compared to the slower stalking play of ODST. Also the buttons being misplaced is even more pronounced. I did find a different layout “Bump and Jump” with the melee and jump buttons of LB and RB which is better, but had to learn to twist my right hand, to bring my fingers on top, to reload (A or B) while using my thumb to move.

Now that I’ve played the ODST, I’m keen to play a more classic Halo, to get a more grounded Halo experience. Not sure if I should play Halo 3 or move to Halo 3 Reach, any opinions?

Also I noticed the fire fight mode of ODST on Wikipedia, so now I’m going to have to try that out, to collect the achievements. Achievements are such a great way to hint that you’ve not experienced all of a game, I love them…