Mobile app version of vmapp.org
Login or Join
Rambettina238

: 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

@Rambettina238

Posted in: #301Redirect #Apache2 #Htaccess #Seo #SharedHosting

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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Rambettina238

1 Comments

Sorted by latest first Latest Oldest Best

 

@Pope3001725

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]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme