Click to See Complete Forum and Search --> : URL masking in Apache


rdeckard9
02-17-2005, 07:30 PM
From an extreme newbie:
I am looking for a way to mask a URL and I understand that there is a way to do it in the httpd config file.
If you go to the following URL, http://www.theuniquegeek.com, you will see that it actually displays http://www1.theuniquegeek.com:8080/.
Is there a way to mask the URL from within Apache so that the latter URL will not be displayed, just the original domain name?

bwkaz
02-17-2005, 08:04 PM
It's really quite simple -- you have to register whatever domain name you want to display, and then just don't redirect the user anywhere else.

;)

The URL will change whenever the web server sends an HTTP 301 response (redirection). There are actually a couple of other response codes that do the same thing too, but I don't remember them right now (the difference is the semantics of each code -- IIRC, 301 has no semantics, there's one code that says "the object has permanently moved, update your bookmarks", and I believe there's a third one that says "the object has moved temporarily, don't change your bookmarks because it might come back or move somewhere else").

But anyway, all of the redirect response codes will change the URL shown in the address bar. Therefore, if you don't want the URL to change, don't redirect the user.

rdeckard9
02-17-2005, 08:23 PM
I guess I should explain in more detail.
Currently, the actual site is setup on my Windows 2000 web server with a redirect to my Linux web server. I want to keep this configuration. However, as I understand it, there is a way in Apache to mask the URL from showing what I actually have configured in my httpd.conf (www1.theuniquegeek.com) to display the correct domain (www.theuniquegeek.com).
Is this true and how would I configure this?

bwkaz
02-17-2005, 11:09 PM
No, that's not true. The only way (that I know of) to prevent the URL from changing is to not do the HTTP redirect. The browser will ALWAYS put the URL that it was redirected to in its address bar, there's nothing you can do to prevent that.

(Certain web servers do allow certain server-side scripting languages to include HTML content from other web servers. But this is generally not a good idea -- it ends up taking way too long, because the user's request ends up waiting for the other HTTP request that the server is making. And I don't believe I've ever seen a way to configure IIS to do that.)

There is a way to make Apache serve multiple different domains, as long as each domain's DNS record points at the same Apache server IP address -- it's called virtual hosting, and the URL that the user types won't change in the address bar. But that won't help with this.

I want to keep this configuration. Why? (Why have the less secure web server out in front? ;)) There might be some other way of accomplishing what you need, if we know why you want to do it the way you're saying.