RewriteCond to change displayed host, but not server
- by coneybeare
Typing out the title to this leads me to believe this might not be possible due to security concerns, but I will ask anyway. I have shortcode support running on my server, lets call it xx.yy
I want it so when a user sends a request to xx.yy, it just changes the displayed host to another valid domain running on the same box.
I have this so far (lets the server know to accept requests from xx.yy):
RewriteCond %{HTTP_HOST} ^.*xx.yy [NC]
RewriteRule ^/(.*)$ http://127.0.0.1:<PORT_OMITTED>%{REQUEST_URI} [P,QSA,L]
RewriteCond %{HTTP_HOST} ^.*mysite.com [NC]
RewriteRule ^/(.*)$ http://127.0.0.1:<PORT_OMITTED>%{REQUEST_URI} [P,QSA,L]
It works, and it directs the traffic into my app, but the url says http://xx.yy when I would rather it say http://mysite.com
I know i could redirect to http://mysite.com instead of 127.0.0.1, but I have 4 parallel boxes of mysite.com and going back out to DNS to maybe go to another box seems like a waste when I am already here. Also, I am not sure how POST requests would work like that.
What can I do?