htaccess syntax is tricky

The following is a web design question for the gurus of Apache server:

One of the most common ways people find my blog is through Google Image Search. It has taken the keywords used to tag my images, as well as the pagerank of the site, and made me a prominent hit for many search terms. The trouble is, when I moved to WordPress, I broke all the links. They have not yet grown back.

Most of the hits are for archive pages for the old blog. For example, someone looking for photos of Oxford might be sent to:

http://www.sindark.com/archive/2006_01_01_sibilant_archive.html

Now, that page still exists. It is at:

http://www.sindark.com/blogger/archive/2006_01_01_sibilant_archive.html

Ideally, the person should be sent to the new post page in the WordPress architecture, but sending them to the new location of the Blogger archive page is better than dumping them into a 404 File Not Found screen.

How can I edit my htaccess file so that anyone looking for:

Xyear_Xmonth_Xday_sibilant_archive.html

will be sent to

/blogger/archive/Xyear_Xmonth_Xday_sibilant_archive.html

Of course, this is a temporary fix until Google finally understands the new architecture of my site.

Author: Milan

In the spring of 2005, I graduated from the University of British Columbia with a degree in International Relations and a general focus in the area of environmental politics. In the fall of 2005, I began reading for an M.Phil in IR at Wadham College, Oxford. Outside school, I am very interested in photography, writing, and the outdoors. I am writing this blog to keep in touch with friends and family around the world, provide a more personal view of graduate student life in Oxford, and pass on some lessons I've learned here.

6 thoughts on “htaccess syntax is tricky”

  1. Working with htaccess is beyond what my brain can manage at the moment. I will take another stab at it tomorrow.

  2. Try using a permanent redirect rather than just rewriting. How about something like this as the first rewrite rule in .htaccess?

    RewriteRule ^archive/([0-9]{4}_[0-9]{2}_[0-9]{2}_[a-z0-9_-]+\.html)$ /blogger/archive/$1 [R=301,L]

    (I’ve not checked or tested that so there may be mistakes)

Leave a Reply

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