We Modified Our Website Now We Are Getting 404s

We recently converted our blogging platform to WordPress. We did a custom template self-hosted version in order to have it match our primary website in basic design and look.  At some point, we will move the entire website onto the WordPress platform but that’s down the line and the subject of another blog.

We Modified Our Website Now We Are Getting 404s

Licensed from iStockPhoto

We left the original blog online for a while as we moved some of the older posts onto WordPress. When we were done, we deleted the old blog files. All appeared well.

A few days later we were checking our domain in Google’s Webmaster Tools and noted we were getting lots of 404 errors on the old blog posts.  A 404 error tells the world that the “requested page was not found” on the server. Apparently we had developed back-links to the old blog site and Google had indexed many of our blog entries.  We were a bit concerned about all the 404s impacting our ranking on Google and were desperately looking for an answer.

Disclaimer: the rest of this is technical in nature.

We’re running an Apache Server and the answer was both easy and elegant.  In the root directory of an Apache Server is a file named, “.htaccess” and this file can be a powerful tool. Our old blog was in the /blog subdirectory and the new blog was in the /wordpress subdirectory.  We wanted any URL calling a file in the /blog subdirectory to be sent to /wordpress/index.php. 

For example:

http://www.thebranchteam.com/blog/archives/2008/09/entry_114.html

Should be redirected to:

http://www.thebranchteam.com/wordpress/

We downloaded the existing .htaccess file to my PC, opened it in notepad, and added the following:

RewriteEngine On
RewriteRule ^blog/.*$ /wordpress/ [R=301]

Basically, the code tells the server to take any requests for files in /blog/, redirect them to /wordpress/, and report it as a 301 (moved permanently) rather than a 404 (file not found)

We saved the file and uploaded it back to our server. Problem solved!

Tom Branch, Broker, CDPE, SFR