0
votes

I have today a blog at Tubmlr, and my domain is like this: blog.example.com. And URL to a post in my blog would be like this blog.example.com/post/34545435345/some-title-etc

Now I have moved all my content to a hosted Wordpress, and my domain is www.example.com. The posts from Tumblr in Wordpress now got a URL like this: www.exampe.com?p=34545435345

I want to set up a .htaccess to 301 redirect from my old subdomain to my new blog. I have tried this rule in the .htaccess -file, but it seems not to work:

RewriteEngine On
RewriteRule ^/?posts/([0-9]+).*$ http://www.example.com/$1
2

2 Answers

1
votes

To all others who got the same issue, here is my solution:

RewriteEngine On
RewriteRule ^/?post/([0-9]+).*$ http://www.example.com/?p=$1 [R=301,L]
0
votes

Looks like it's just due to inconsistencies in your example and your RewriteRule: your rule has /posts/ instead of /post, and your destination is missing the "?p=". You should also add the R=301 flag. Try this:

RewriteEngine On
RewriteRule ^/?post/([0-9]+).*$ http://www.example.com/?p=$1 [R=301]