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
ItsMeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jhurstCommented:
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?
0
ItsMeAuthor Commented:
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
0
monasCommented:
Use proxy module and proxy all your connections to some directory and it's subdirs to your new domain.
0
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

ItsMeAuthor Commented:
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
0
jhurstCommented:
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.
0
ItsMeAuthor Commented:
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 ?
0
jhurstCommented:
Yes, but if you get the URL that was entered you will either be at that location or at an error document.  If it exists, then you will be there, if not, you will be at the error document, hence my suggestion of a 404error.cgi file to catch the error and then route you to where you really need to be.  

Certainly the 404error.cgi can re-direct through a location: xxx but remember this is an extra transfer.  Performance is better if that script actually sends what is really wanted.  Having said that, the code I referenced above acutaully uses a <meta to do the re-direct which is just as bad, except that it at least allows something to show while the re-direct is happening.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ItsMeAuthor Commented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.