301 Redirect To Post ID

  • I have an existing asp based blog where all posts contain a post id in their URL (template_permalink.asp?id=123).
  • I have a blank WordPress blog. I will have to recreate all of my posts manually, because the feed from my existing blog doesn’t contain the original images (it just has a CDATA block) so I can’t import them.
  • I need to to redirect the original posts to their equivalent WordPress post.

I have tried:

What I would ideally like is to be able to either:

  • Change the WordPress post id manually to match the original id. Is there a way to do this?
  • Or even better would be to manually add the 200 posts in htaccess and redirect to a pretty URL, in which case please could you advise of how to format this for htaccess?

Related posts

2 comments

  1. When you are importing via code (which is practical necessity for large imports) you can supply import_id argument to wp_insert_post() to be used.

    There is however no clean/safe way (that I can think of) to specify or modify post IDs manually.

    In your case (if you are really stuck with manually created posts) I would add IDs as post meta through editor and when site is hit via old format link extract the ID and look up via meta query if there is matching post to redirect to.

  2. I have now found a plugin called Redirection that achieves the page by page redirect.

Comments are closed.