skip to Main Content

I have a website, lets say www.domain.com

and my current blog is at www.domain.com/blog/

so my URLs are like www.domain.com/blog/recent-post/

now Im having a new wordpress installation to handle blog, and pointed a subdomian to it, so the blog now is blog.domain.com

I have lot of seo work dne forwww.domain.com/blog/ I dont want to miss that, and I want to redirect users visiting www.domain.com/blog/ to www.blog.domain.com/
and www.domain.com/blog/any-url/ to www.blog.domain.com/any-url/

can some one help in writing redirection rule for this?

2

Answers


  1. Why do you want to change domain.com/blog to blog.domain.com?

    This isn’t good for SEO, since the links do not have the same value for a directory that for a subdomain.

    Better to have the blog in a folder that subdomain, since the authority will always go to main domain (domain.com).

    Login or Signup to reply.
  2. If in spite of @Cailbuig’s advice you still want to do this, what you’d need is

    Options +FollowSymLinks -MultiViews
    RewriteRule ^blog(/.*)?^ http://blog.domain.com$1 [L,R=301]
    

    Start with R=302 and then when it works change to R=301. 301 reponses are cached by browsers, so they are hard to test.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search