Similar to question posted here (but not related to sub directories): .htaccess redirect of domain name alias to main domain but must show up as the alias domain
I am trying to direct traffic from an alias domain I have to my site that is on the same server, while also keeping the alias domain in the browser address bar.
This is my original htaccess content which correctly redirects the user, but xyz.com appears in the browser which I do not want.
rewritecond %{HTTP_HOST} ^(www\.)?abc\.com$ [NC]
rewriterule ^ http://xyz.com/?foo [R=301,QSA,L]
This is my attempt to not only bring abc.com visitors to xyz.com but also have abc.com appear in the browser. This doesn't even load the site. Any ideas on a fix?
rewritecond %{HTTP_HOST} ^(www\.)?abc\.com$
RewriteRule ^$ /index.html [L]
DocumentRoot
of the alias domain? If you point that to the same path as the "main domain"" you can do it without theRewriteRule
-stuff. If you can't change that, then you have to use RewriteRules, in that case you probably have to replace/index.html
with the correct relative path. So if, for example, the index.html of the main-domain is in the directory above you have to write../index.html
. – vstm Sep 28 '13 at 15:47DocumentRoot
and not in one of it's parent folders. So/index.html
points to/path/to/aliasdomains/index.html
(my solution with../index.html
wouldn't work either). You could just copy or symlink the file from the root folder to your aliasdomains folder. If that's not possible and your apache comes with the proxy module, you could do a proxy-rewrite withRewriteRule ^$ http://xyz.com/index.html [L,P]
. – vstm Sep 29 '13 at 8:25