301 Redirects for moving from mydomain.com/oldblog to blog.mydomain.com (2 posts)

  1. imagebox
    Posted 4 years ago #

    I moved my blog from mydomain.com/oldblog to blog.mydomain.com I need to create 301 redirects from all of the old urls to the posts and pages to the new.

    The permalink structure is the same. The only difference is mydomain.com/oldblog/post1 is now blog.mydomain.com/post1

    I know I can do a 301 redirect within .htaccess which will automatically take a link like http://mydomain.com/oldblog/post1 and send it http://blog.mydomain.com/ but I need them all to match up! I cannot just have all old posts/pages pointing to the root URL of the new blog address.

    Is there any automated tool to do this? I have about 850 blog posts/pages which need this and I cannot do this manually.

    Thank you,


  2. Johnb81
    Posted 4 years ago #

    You can try adding the below to your .htaccess file

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^olddomain.com/blog$ [OR]
    RewriteCond %{HTTP_HOST} ^www.olddomain.com/blog$
    RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]

Topic Closed

This topic has been closed to new replies.

About this Topic