Forum Moderators: phranque
Scenario:
www.domain1.com (primary acct.)
www.domain2.com (add-on domain)
www.domain3.com (add-on domain)
I'd like to be able to point all 3 to the primary account public_html folder. However, when the user comes in as www.domain2.com or www.domain3.com, I'd like for the user to continue seeing that domain in the addressbar.
None of these are high-traffic sites.
I did find a bit of info, but it's doesn't seem to work...puts my add-on domain into what appears to be an infinite loop.
Could someone please let me know where the code is incorrect...corrections are completely welcome? Also, I have no idea how to add the third domain.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domain1.com$ [NC]
RewriteRule ^(.*)$ [domain2.com...] [R,L]
Much appreciation in advance for any help given.
What you do need is correctly-configured DNS, and the server must be configured to recognize all the domains that are pointed to it.
You code says, "if the requested domain is not domain1, redirect the request to domain2." So, of course, after the first redirect, the requested domain is now doamin2, which is not domain1, so you get another redirect - again and again.
You may need to do some mod_rewriting for other purposes, but you do not need this code (or any other) in order to achieve what you said you wanted.
Jim