Link to home
Start Free TrialLog in
Avatar of ItsMe
ItsMe

asked on

use script to "hide" a routing domain

Hi ! I'm routing a domain to another server. How do I write a script, which makes the user believing that he's still on the in-typed server ? the script must work with all kind of files ! I thought of replacing the www.servername. in the script by the new server. but how do I print out the wished file ? and where do I need to run the scipt ? if a user types in www.test.com/test/test.htm the script must be started first ...

regards
ItsMe
Avatar of jhurst
jhurst

You can not!  The browser shows where it is.  There are some tricks that will get you close to where you want to go:

My company: www.resource.nu offers a re-direction service by which we grab the page that is requested and then serve it from our site, on the fly.  

I have seen people get away with frames, where they have the top frame at the site they want to show and this frame actually shows what it uses by having the real text in other frames, which may be the entire screen, from other servers.  This works until the user selects "open frame in new window" then he sees the URL for the frame.

These are your choices.  Sorry!

BY the way, why do you want to do this?
Avatar of ItsMe

ASKER

I heard that it works when you save in each directory an cgi index.cgi and then grab the url, convert it and print out the content of the converted filename. then the user will always see ../doc.htm
or so. frames are not the solution I want to use. til now I'm routing my domain directly to another URL.

there must be an solution. it is possible to download files by an cgi so it must be possible to auto-start an cgi and print into the new html site (which has the cgi-name as url) the requested content.

regards
ItsMe
Use proxy module and proxy all your connections to some directory and it's subdirs to your new domain.
Avatar of ItsMe

ASKER

i want to convert the URL to a directory path which is valid for the
server where the url points to. how do i get the url ? QUERY_STRING doesn't work ! If I run an cgi as index.cgi each access to the server will start this cgi first, so I can make this rooter service....


regards
ItsMe
an index.cgi can discover which directory it is operating from by looking at $ENV{SCRIPT_FILENAME}, $ENV{DOCUMENT_NAME}, $ENV{SCRIPT_NAME} or $ENV{DOCUMENT_URI} or whatever other variables your server sets.

I should warn you, not all servers set them all, so a little experiment with these 4 will be a good idea.  Then, you script can open whatever it wants.  What I do not like about this is that there is little way for the script to know what file type, jpg, etc was wanted.

I vastly prefer, assuming that you are using Apache or some system that allows re-direction of error documents, to use a 404error.cgi and use $ENV{REDIRECT_URL} to determine what was originally asked for.

We use this method on our home site: www.resource.nu . So, if you enter www.resource.nu/hello we will get an error message, since there is nothing like that.  If you enter www.resource.nu/big, we assume that you meant bigt and will take you there, after telling you.
Avatar of ItsMe

ASKER

isn't it possible to get the URL typed in and then covert it and print "location:" ? I'm using Microsoft-IIS/4.0

regards
ItsMe

Perhaps you have an example script code ?
ASKER CERTIFIED SOLUTION
Avatar of jhurst
jhurst

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ItsMe

ASKER

I want to get the URL which was wanted with index.cgi then index.cgi can convert the URL e.g. from www.pixeltrack.de to d:\www\milleniumserver\pixeltrack to catch the requested document. and print the document content ... isn't there an example solution somewhere ?

what I want to do:
www.pixeltrack.de points to www.milleniumserver.de/plw/index.htm

index.cgi at milleniumserver shall now print index.htm or another document eg
/plw/something/test.htm

regards
ItsMe