Htaccess rules needed for subdomain name change
-
I recently changed the name of a child site (subdomain setup) to a different name. I want to maintain all the old incoming links by pointing them to the corresponding location on the new child site. So from blog.domain.com/some-posts/ -> to blogat.domain.com/some-posts/
I have set up blog.domain.com (empty web folder) and configure it to redirect to blogat.domain.com via cPanel, but this only affects the subdomain itself, not the corresponding posts…So users going to blog.domain.com/some-posts/ still get 404.
I tried this
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^blog.domain.com
RewriteRule (.*) https://blogat.domain.com/$1 [L]
</IfModule>and this
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^blog.domain.com
RewriteRule (.*) https://blogat.domain.com/$1 [R=301,L]
</IfModule>Neither one worked. This block of code is placed at the top of the htaccess file, above the existing wordpress rules. How can I modify it so the site will redirect the way I want it to?
Regards,
Angela
- The topic ‘Htaccess rules needed for subdomain name change’ is closed to new replies.