views:

27

answers:

1

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?

A: 

If mysite.com is on the same box, and DNS is pointing there, just put R=301 in [P,QSA,L]

Example

RewriteEngine on
RewriteCond %{HTTP_HOST} ^OldDomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.OldDomain.com$
RewriteRule ^(.*)$ http://www.NewDomain.com/$1 [R=301,L]

From http://www.liewcf.com/redirect-webpages-to-another-domain-538/

Other than that, though there's no way for good reasons to do what you are asking. Imagine if someone could link to legitwebsite.com, but have it get sent to evilempire.com.

It'd be chaos, that's what.

davethegr8
Makes sense, I never thought about it this way until I read back what I had written for the title
coneybeare