Forum Moderators: phranque

Message Too Old, No Replies

Need hidden redirect which keeps URL parameters

         

ullux

1:39 am on Nov 17, 2009 (gmt 0)

10+ Year Member



I want to use a .htaccess file in the root folder of www.mysite.com to have users redirect to where the content actually resides, which is www.realsite.com.

However, the new url should not show in the webbrowser, because it's so ugly.

And all URL parameters ?nameX=valueX... should be preserved.

Example:

-User types www.mysite.com/?name5=415
-browser shows him exactly that URL.
-The content he gets to see however is in fact www.realsite.com/?name5=415.

So all URL parameters are passed back and forth correctly, but he doesn't see the ugly domain name the content actually comes from.

searched a lot but didn't find a solution for this pretty specific problem ;/

thanks in advance!

jdMorgan

2:51 am on Nov 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See Apache mod_proxy. You'll need to set up a reverse proxy to forward requests arriving at mysite over to the server at realsite, and to pass responses from realsite back through the mysite server to the client.

You'll also need to set up the HTTP X-Forwarded-For header on mysite, and modify the logging configuration on realsite to log X-Forwarded-For instead of Remote_Addr or Remote_Host. Otherwise, realsite will log *all* requests as coming from the IP address of mysite, and you'll have no logs of visitor IP address data to do 'tracking' with.

This is a non-trivial configuration, and both servers will have to do work (and will have to work) in order to serve requests. In addition, there may be two DNS lookups per request, one at the client, and one by the mysite server. So, this is complex, doubles your chances for outages, and can double the time required to do DNS lookups and serve requested objects.

Be very sure this is actually necessary before starting, as it's going to be quite a bit of work, and quite a bit of time with the documentation...

[added] You'll need server configuration access on both ends -- This isn't something that can be done using only .htaccess files. [/added]

Jim

ullux

8:28 am on Nov 17, 2009 (gmt 0)

10+ Year Member



Thanks for the reply, I didn't expect it to be that complicated. And I don't have access to the required configurations I guess.

However, my provider offers 'frame redirection'. If I use it, the browser will actually only display the www.mysite.com URL while www.realsite.com remains completely invisible from the user.
The only problem is that this frame redirection eats all URL parameters too. So the url will always stay exactly "www.mysite.com" even if it should be "www.mysite.com/?namex=valuey...".
Is it maybe possible to just add the parameters being displayed to this frame redirection, sort of "completing" the feature?

g1smd

9:58 am on Nov 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do not ever use Frame Redirection. It is mis-named. There is no redirection involved at all, and this technique stops search engines properly getting at your site.

If someone recommends this method, run away. Very fast.

jdMorgan

1:40 pm on Nov 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It won't be possible to recover the parameters lost in the frame redirection.

Really, if you need to do this, it's going to require an upgrade to a VPS or dedicated server -- i.e. to a service level where you have server config access. Either there's going to be a return on that investment, or there's not -- Only you can assess the cost/benefit of doing this.

There's a good reason it's difficult to do this and will likely remain difficult even as the Web progresses -- Web users deserve to see accurate information about the actual sites they are visiting. Otherwise, the security problems would be massive.

Jim

ullux

5:37 pm on Nov 17, 2009 (gmt 0)

10+ Year Member



Thanks for good advice everyone