How to Use .htaccess to Redirect a Wordpress Site
Posted on June 30th, 2008
Usually, it is fairly straightforward to use a .htaccess file to redirect an old website to a new one. Yet for some reason, I was having the hardest time getting this to work for my wife’s old blog. There was a link that came up when you Googled her name, and I was using that link to test the redirection.
The problem was that it would not only redirect to the new domain, but include the full URL. And since her old blog used a different folder structure, people who clicked this link would receive a 404 error.
The specific issue was there was a question mark in the URL, which made the URL into a query string, which is handled differently than normal forwarding requests in an .htaccess file. The solution?
Put a question mark at the end of the RewriteRule. So in this specific case, the file now looks like:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*leanneheller\.com$ [NC]
RewriteRule ^(.*)$ http://www.guidetoworlddomination.com? [R=301,L]
Adding that question mark to the end seems to overwrite any previous query string requests, and will send any requests from the old domain to the root of the new one.

Last Friday, I was browsing Twitter when I came across someone who mentioned how excited they were to be going to An Event Apart in a few days. 

About
I am a 26 year old web developer by day and technology consultant by night, living north of Boston, MA. I am a fan of calzones, Mates of State, and all things web.
Twitter
Flickr Photostream
Digg
Del.icio.us
LinkedIn
The Sixty One