• We recently moved to a new website. The older blog was a separate site with the URL blog.domain.com. With the migration, the blog is now part of the main site with the URL – domain.com/blog. I’m told there is a way to do this via .htaccess. I followed this link but it didn’t help. Any ideas how I can do this? I also needed the tag, category and archives URL to redirect as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Add this to your htaccess file

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^blog\.domain\.com$ [NC]
    RewriteRule ^https://domain.com/blog [NC,R=301]
    Thread Starter hpb1980

    (@hpb1980)

    Didn’t quite work. Is it supposed to be like this?

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^blog\.domain\.com$ [NC]
    RewriteRule ^https://domain.com/blog [NC,R=301]
    
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Hi hpb1980,

    Sorry for the late reply.

    That code works for me. You can use Redirection plugin.

    I don’t want you to make mistake in your .htaccess, a small mistake in your .htaccess code can make your WordPress site inaccessible, and it may start showing Internal Server Error.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirecting subdomain URLs post migration’ is closed to new replies.