*Slaps forehead*
Redirect /wordpress/
http://www.welovecelebs.com/wp/ It all seems so simple now; I can't believe I didn't think of it sooner.
We had to move my wife's
celeblog to a new server (and new address) recently, as it's popularity was threatening to eat up the bandwidth of the old one. Once all of the
WordPress files had been copied over and all the MySQL tables had been edited to incorporate the new URL, I still needed to find a way to redirect requests for the old pages to the new ones. At first I just used a bit of quick 'n' dirty PHP but that wasn't able to redirect specific posts to their counterparts at the new address, instead it would take visitors to a page that explained the server changeover and included instructions on how to find the post they were looking for.
This was hardly an ideal scenario considering that the laziness of 90% of 'net users prohibits them from making anything more than the slightest effort when it comes to searching for something; it also had the knock-on effect of leading to a decrease in traffic since many people that found our site through search engines (that still list the old links in their search results) weren't finding the information they wanted at the first attempt, and weren't sticking around to read other things on the site like they might have done had they been able to find the information they needed at the first click.
So, I needed to find a proper solution. Then it hit me that using the
.htaccess 'Redirect' directive might provide what I was looking for. So by inserting the code quoted above into the old WordPress folder's .htaccess file, I was able to send all requests for the old posts to their new equivalents, then by using
Scott Yang's Permalink Redirect plugin I was able to redirect the "index.php?p=xx" style post links to the friendlier "/category/post-name/" permalinks.
So now, if one searches for something on say, Google, and clicks on one of my wife's old links, they'll go through this redirection process, almost transparently:
1.
www.google.com2.
www.oldsite.com/index.php?p=xx3.
www.welovecelebs.com/wp/index.php?p=xx4.
www.welovecelebs.com/wp/category/postname/ Thus, all page requests related to WordPress on the old server are sent to the new site instead, whilst files in unrelated directories aren't affected since the .htaccess file only applies to the WordPress folder. This makes my wife very happy, which in turn makes me happy. :)