I have got customer.mydomain1.com and want to mask it to customer.mydomain2.com
so that customer.mydomain1.com shows content of customer.mydomain2.com and url stays the same as of customer.mydomain1.com
I am using the code below used in my .htaccess, which gives me ERROR 400
RewriteEngine On
RewriteCond %{HTTP_HOST} ^customer.mydomain1.com
RewriteRule ^(.*) http://customer.mydomain2.com/$1 [P]
I would just use a ServerAlias this works for any domain that have an A-Record or a CNAME pointing to your server:
No need to use mod_rewite with mod_proxy (required for the the [P] Flag) All listed domains (you can add as many you like)
will respond with the content of
/var/www/path/to/public_html
so just replace it with the public directory of your customer.mydomain2.com server.I can't see anything wrong in your config. I used this configuration on my local apache, so both domains are on the same HTTPD:
Then changed my local hosts file to define both domains, and it works. I get the content of index.html if I access http://customer.mydomain1.com. I also created other files, in sub-directories on customer.mydomain2.com and when I access them, customer.mydomain1.com stays in the address bar.
So either there is something in your configuration, or some module is missing. Does $(apachectl -t) return "Syntax OK"? Did you restart your apache?