: Rebranding: how do I redirect my website to a new domain, and blog to a subdomain? I have a website that I am rebranding and using a new domain name for. Right now it is primarily a blog
I have a website that I am rebranding and using a new domain name for. Right now it is primarily a blog hosted at the root.
I am going to be redirecting from old.com to new.com, and I also want to move my blog to blog.new.com. Currently old.com doesn't serve any subdomains.
Based on the research I've done, it would seem that I need to use 301 redirects because these should be permanent. I just don't really know what I need to do to setup these redirects. Should I use mod_rewrite?
My sites are hosted on Dreamhost so any Apache configuration that I would need to do I believe I'd have to do in an .htaccess file.
More posts by @Rambettina238
1 Comments
Sorted by latest first Latest Oldest Best
All of the following code will be placed in a file called .htaccess in your root web directory and mod_rewrite enabled on your server.
Changing the domain is easy to do. The following snippet should do it:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?old.com$ [NC]
RewriteRule ^(.*)$ www.new.com/ [R=301,L]
To move your blog you can use the following snippet (assuming your blog is in a subdiretory called /blog):
RewriteCond %{HTTP_HOST} ^blog.old.com$
RewriteCond %{REQUEST_URI} !^blog/
RewriteRule ^(.*)$ blog.new.com/ [L,QSA]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.