How to redirect a default WordPress URL

Ok, I was trying to help a friend who is replacing WordPress with another system and needed to redirect the WordPress URLs for old posts to the new URL and the new posts. Doesn’t seem like that would be too much of a problem, except that the default WordPress uses html get values and not URLs to direct to a specific post. Given I’m not a mod_rewrite expert, it took a little digging and playing to figure out how to do it. Below is an example of how to do it using mod_rewrite and the .htaccess file in the root of the WordPress install:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^p=1$
RewriteRule ^$ http://www.thenewdomain.com/the/new/url/story.html [R=301,L]

This assumes that your hosting provider allows mod_rewrite and that .htaccess overrides are allowed. The only problem with this is that the new url get the ?p=1 part tacked on to the end of the new url after redirect. In this case it didn’t cause a problem, but it doesn’t look perfect. I’m still trying to figure out how to dump this.

About D-Caf

I'm a computer geek, what more is there to say?
This entry was posted in David, Software, Technology. Bookmark the permalink.

Leave a Reply

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