Forums

Redirect posts from Domain to Subdomain (2 posts)

  1. GetWebHost
    Member
    Posted 2 years ago #

    I have previously a blog at my http://www.domain.com It has posts like:

    1. http://www.domain.com/1/post_title/
    2. http://www.domain.com/100/new_post_title/
    3. http://www.domain.com/500/another_post_title/

    Now, I want to redirect all these posts to the subdomain because I have something to put on the main domain.

    These are the processed that I currently made:

    1. Transfer the blog installation to the subdomain. So currently, I have now http://blog.domain.com/1/post_title/, etc.
    2. Deleted the WP installation from the main domain

    Now, I'm stuck on what could be the .htaccess to put on the root so that all the old permalinks (http://www.domain.com/1/post_title....) will be redirected to the newly installed permalinks (http://blog.domain.com/1/post_title....)

    Please take note that accessing http://www.domain.com must NOT redirect because I have put new something in here, something like a frontpage.

    I have search so much about this but the results are opposite (subdomain>domain)

    Any help is greatly appreciated.

  2. jceresini
    Member
    Posted 2 years ago #

    The following should redirect any non-existant files on domain.com to blog.domain.com. Thats probably the easiest way to do it without redirecting everything

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
    RewriteCond %{REQUEST_FILENAME} -d [NC]
    RewriteRule ^(.*)$ http://blog.domain.com/$1 [R=301,L]

    [signature moderated Please read the Forum Rules]

Topic Closed

This topic has been closed to new replies.

About this Topic