WordPress.org

Forums

Disabled multisite - redirecting subdomain posts to domain posts (2 posts)

  1. remodelvintage
    Member
    Posted 1 year ago #

    Hey there,
    I have disabled the multisite functionality and also restored the htaccess file after I imported the blog (subdomain) posts to my main site.

    I now want the blog urls to be redirected to the imported post urls on my main site, note that the permalink structure was different on my blog as well
    from: blog.mainsite.com/2013/08/postname
    to: mainsite.com/postname

    i tried

    RewriteCond %{HTTP_HOST} blog.mainsite.com [NC]
    RewriteRule (.*) http://www.mainsite.com/ [R=301,L]

    and also tried to redirect the urls one by one, as there were't that many posts, nothing worked.

    can anyone help?

  2. If you want to redirect the posts, it's this:

    RewriteCond %{HTTP_HOST} blog.mainsite.com [NC]
    RewriteRule (.*) http://www.mainsite.com/$1 [R=301,L]

    But since we're doing /2013/08/postname to postname it's this:

    RewriteCond %{HTTP_HOST} blog.mainsite.com [NC]
    RewriteRule ^([0-9]{4})/([0-9]{2})/(.*)$ http://www.mainsite.com/$3 [L,R=301]

Topic Closed

This topic has been closed to new replies.

About this Topic