Redirect root to a new domain
Moderator: General Moderators
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Redirect root to a new domain
How can I redirect the the root of domain1.com to domain2.com/folder, but without changing the URL in the address bar (so after the redirection is done, domain1.com will be still there).
Re: Redirect root to a new domain
Probably mod_rewrite could be a solution.
There are 10 types of people in this world, those who understand binary and those who don't
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: Redirect root to a new domain
Yes, but how to? 
Re: Redirect root to a new domain
What have you tried so far
?
There are 10 types of people in this world, those who understand binary and those who don't
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: Redirect root to a new domain
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain1\.com [NC]
RewriteRule ^(.*) http://domain2.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.domain1\.com [NC]
RewriteRule ^(.*) http://domain2.com/$1 [R=301,L]
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Redirect root to a new domain
This is not possible with mod_rewrite. There is a few hacks you could do to simulate the behavior, such as an iframe (simple), or proxy (complicated + slow).klevis miho wrote:How can I redirect the the root of domain1.com to domain2.com/folder, but without changing the URL in the address bar (so after the redirection is done, domain1.com will be still there).
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: Redirect root to a new domain
Or with some DNS trick?
Do you know how to do it with DNS?
Do you know how to do it with DNS?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Redirect root to a new domain
I wouldn't know how to do it with a sub folder, but you can easily turn that into a subdomain, at which point you could do this.