I have a domains test1.xxxxxx.com, test2.xxxxxx.com, test3.xxxxxx.com and so on which point to my DMZ ip address.
On my DMZ I have an apache web server.
The apache web server needs to redirect
test1.xxxxxx.com to test1.xxxxxx.com (192.168.1.1) on the internal network
test2.xxxxxx.com to test2.xxxxxx.com (192.168.1.2) on the internal network
test3.xxxxxx.com to test3.xxxxxx.com (192.168.1.3) on the internal network
The mapping for test1.xxxxxx.com to 192.168.1.1 and so on is specified in hosts file
I have
<VirtualHost *:80>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(test1.xxxxxx.com)$
RewriteRule ^(.*)$ http://test1.xxxxxx.com [R,L]
RewriteCond %{HTTP_HOST} ^(test2.xxxxxx.com)$
RewriteRule ^(.*)$ http://test2.xxxxxx.com [R,L]
RewriteCond %{HTTP_HOST} ^(test3.xxxxxx.com)$
RewriteRule ^(.*)$ http://test3.xxxxxx.com [R,L]
</VirtualHost>
When I try to hit http://test1.xxxxxx.com in browser I get This webpage has a redirect loop
If I have
<VirtualHost *:80>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(test1.xxxxxx.com)$
RewriteRule ^(.*)$ http://test2.xxxxxx.com [R,L]
</VirtualHost>
Then the rewrite works.
Something similar used to work, but I changed my server and above does not work. What do I need to tweak to make this work.
Thanks in advance