Proxy all requests for subdomain to an ip via htaccess/apache
Solution 1:
You need ProxyPassReverse
- it catches Location
fields in response headers and alters them so that the client will continue talking to the proxy, instead of the backend server.
ProxyPass
and ProxyPassReverse
cannot be in an .htaccess
file - so replace your current rewrite rule with this, which should go inside your <VirtualHost>
block for the subdomain:
ProxyPass / http://193.159.3.129/
ProxyPassReverse / http://193.159.3.129/
As an aside: do not use .htaccess
when you can avoid it. Review the Apache documentation on the matter.
In general, you should only use .htaccess files when you don't have access to the main server configuration file.