0

I'm moving a client from Tumblr > WordPress. I can't figure out how to make the new permalinks work.

Two issues:

  1. The current Tumblr urls look like this: http://blog.example.com/847336253/post-name But when I import the posts to WP, it chops off the end of the urls. I end up with just: http://blog.example.com/847336253/ So, question 1: Can I append a slug to the end of that number? I've found a handy script that will rewrite the urls for me, removing the numbers and leaving me just with /post-name. But I'd like to keep that number in there.

  2. The url of the site is changing from http://blog.example.com to just http://example.com. So, question 2: Can I accomplish a proper redirect with a 301 directive in my htaccess file?

2
  • 1. Settings > Permalinks 2. Yes
    – eyoung100
    Commented May 22, 2014 at 20:56
  • You should only keep to one question per post. More than one question per post is not allowed, and this falls into the "too broad" spectrum, which means that there is no way of properly answering your question in a few well structured sentences as there are to many possible answers Commented May 23, 2014 at 6:34

3 Answers 3

1

For the first question, you would need a rewrite plugin, as WordPress wouldn't be able to handle the numbers in that string otherwise (it would see every site as a 404 Not Found), as slugs can't contain slashes of any kind.

Ideally I think your best approach would be to set the post names without the digits (to make them human readable), and then use a plugin such as the Redirection plugin to forward requests to the old URL (with numbers) to the new one (you can set up a regex redirection here, so a simple rule to strip out just the numbers, or you can do one redirection per URL if you want to be extremely thorough).

As for the permanent 301 redirect for removing the blog sub domain, the plugin mentioned above can handle this as well. Manually editing the .htaccess file isn't advised as plugins or themes may issue a hard refresh which overwrites the content of that file.

1
  • This is exactly right. Redirection handles this perfectly. All I had to put in was: .*/post/\d+/(.*) > /$1 and it all forwards along exactly as expected. Thanks so much for your help with this!
    – saltcod
    Commented May 23, 2014 at 11:48
0

Answer 1 Set %postname% as your permalink.

Answer 2 For the 301 redirection, put the following code in your .htaccess file and put it inside the root directory of blog.example.com

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
0

Go Inside wordpress admin panel -> permlinks and you can add %postID%/%postname% to the custom permalink field and you should be good to go.

1
  • Not a bad thought, but that number in the Tumblr url isn't actually the post ID. The post IDs were assigned starting from 1 when the Tumblr content was imported, so those long numbers in the url don't mean anything.
    – saltcod
    Commented May 23, 2014 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.