Help with mod_rewrite to preserve Movabletype perm
-
I’ve got a Movabletype blog and I’m thinking of moving to WP. I’ve installed WP sucessfully in a sub-directory of my site root, and everything seems to be working well. My problem is that I want to make sure that when I finally import my posts and comments from the MT database, I don’t break existing permalinks to those posts either from external sites, or from within the site itself (as I sometimes link to previous posts).
I’d like to leave the new WP installation where it is, and just import the old MT entries in (I’m hoping against hope that the post IDs will remain the same if I start with a new WP database – is this true?).
This is my current structure:
[1] MT blog archives:https://www.mysite.com/mt-static/blog/archives/000001.html
(the post id is padded to 6 digits with 0’s.
[2] WP directory root:https://www.mysite.com/wp/
The document root ofhttps://www.mysite.com/ is /home/me/public_html/
So I would like to use mod_rewrite to, 1) redirect links in style [1] to corresponding entry in the new blog, and 2) make friendly URLs to entries in the new blog of the form
https://www.mysite.com/wp/archives/%year%/%monthnum%/%day%/%postname%/
.
My first guess is to put the following in the .htaccess at the root of my public_html to redirect old style links:
RewriteEngine On
RewriteRule ^archives/000+([0-9]{1,3})?.html#([0-9]+)?/?$ /wp/index.php?p=$1&page=$2 [R]
Then the following at the WP root [2] to write the friendly URLs:
RewriteEngine On
RewriteBase /wp/
RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([0-9a-z-]+)?/?([0-9]+)?/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
RewriteRule ^archives/category/?(.*) /wp/index.php?category_name=$1 [QSA]
Does this look OK (I’m a real novice with mod_rewrite)? I can’t try it out until I delete the old archives, so I want to be sure that it will work. Can anyone suggest a more efficient way to accomplish the same thing?
Thanks in advance for any help
- The topic ‘Help with mod_rewrite to preserve Movabletype perm’ is closed to new replies.