-   Linux - Server (
-   -   viewing an externally hosted website from within a given website (

andrews-mark 09-20-2008 09:24 AM

viewing an externally hosted website from within a given website
Sorry if the title is a bit misleading or weird, I found it difficult to phrase the subject matter.

I have a problem where I need to host a website on a particular machine with a particular url, but I also need this website to be available from another url hosted on another machine.

Basically, my problem arises as I need a particular website hosted on a server I own to appear as my personal homepage on my university's website. In other words, let's say my homepage is and my own website hosted on a private server is I can create a nice dynamic site at and I can not do them same at (I can just use static html there). I would like when someone browses to for them to end up at Obviously, I could redirect them with a simple redirection page at, but I want the urls they are looking at to be* and not*. The reason I want this is because I want my website to appear to be officially part of the university's site.

I can talk to the system administrators who run the university's website and I know they will help me if I can make a definite request that is relatively easy for them to implement (they are using apache, btw). Trouble is, at the moment, I don't really know what I need to ask them. I presume this issue is handled by some sort of IP address translation, but I'm not sure.

Does any one know if this type of thing can be done, and how?

many thanks

mjmwired 09-20-2008 11:26 AM

I am pretty sure this cannot be done in anyway whatsoever.

The only thing that Apache can do for you is to automatically redirect certain URL's to automatically redirect to another URL.
For example, every time someone types it will automatically end up at
But after that all navigation will be through your own domain.

You can use some sort of IFRAME tag in a static HTML page on your university page that will load content from your own domain.
Or you can write a Javascript/AJAX webpage in static HTML/JS that will send requests to your own domain and make it look like it is all on your university page.

andrews-mark 09-21-2008 02:19 AM

Hi - thanks for the advice (mjmwired). I'm surprised to hear that it is so difficult, but if that's the way it is then that's the way it is.

Savet 10-03-2008 04:17 PM

Since you mentioned only being able to use static pages at your university site, I'm assuming php and asp are out of the question.

You could, however, do an iframe that loads your private website in the shell of your university site. The only downside is that without server side scripting, you'd need to write javascript functions to grab page variables from the container url and pass them to the contained page.

This isn't really a server side option...but it might be the only way to accomplish what you're wanting to do.

timnp 10-03-2008 07:02 PM


I've had to do this kind of thing before, to do it properly it does require configuration at the apache level. Look up these configuration directives...

Basically in their host or virualhost you would have to get the sysadmins to add

ProxyPass /myhome/

If your site uses internal redirects they you might also need to set up

So that they get redirected to the corresponding page on the .edu which will in turn get the right page from your site.

This requires the apache mod_proxy but any large installation will probably have that already (it might even be on by default i can't recall)

The way that this would work is your visitor would visit your page on the university domain, the university web server would then contact your webserver to get the page and then return it back to the original viewer exactly as though it had come from the uni server. does that make sense?

It does mean that in all the logs of your website on your server you will see many requests from the same ip (the ip of the uni server), even though these are probably lots of different people from all over the place.

One final point is that your university sysadmins might have an issue with this as it would in theory mean that you could publish any content that would then appear to come from the universities website and perhaps affect its reputation, then again because they are at least letting you put static content up already this might not be so much of an issue.

Infact, you might not even need to ask them, I'm not sure but you might be able to set this up using a .htaccess file.

I sincerely hope this helps you, let me know if you get stuck.

Savet 10-04-2008 01:48 AM

In the event that the admins will not configure apache to suit his site, another option that came to mind is a screen scrape.

The wikipedia page should get you started:

You could write it in javascript, and direct the output to the innerHTML of a div tag.

andrews-mark 10-07-2008 01:11 AM

Hi - many thanks for all the advice. very helpful indeed.

All times are GMT -5. The time now is 09:43 AM.