- 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:
-
To 301 redirect all
template_permalink.asp?id=xxx
URLs to a post id using htaccess but it retains the original id so to make this work I would have to manually change the WordPress post idâwhich I can’t work out to doâso it doesn’t hit the right page. My code:Redirect 301 /template_permalink.asp http://www.example.com/
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?
When you are importing via code (which is practical necessity for large imports) you can supply
import_id
argument towp_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.
I have now found a plugin called Redirection that achieves the page by page redirect.