Revista Kloperwin: About The Sense of Knowledge

Choose a Topic:

Tue
3
Jun '08

Programing for a mapped server port

If you have only one IP available and you need more than one server, chances are to have one server on port 80 and other using a router mapped port 8080, but you do not want to change your server default port 80 to 8080, so you only map your router port 8080 to port 80 into the local ip address of your second server.

The problem is that your relative links won´t work because any link to src=images/whatever.gif will be searched as port 80, because your server is working on port 80.

So you will need a preset variable to handle your links

$routed_port = 8080;

$SiteURL = ‘http://’.$_SERVER['SERVER_NAME'].’:’.$routed_port.’/';

Noy your links will be

src=$SiteURL.’/images/whatever.gif’

Of course this is a simplified explanation with no tags, but it must be used in all cases, even forms.