From: Jeff D. <da...@da...> - 2003-03-09 04:04:47
|
> My SERVER_NAME is not defined in my apache configuration and I think > this is a good thing. This allows me to have relative links that work > in my local network and also when people are accessing my website from > the internet. Yes, but your server really ought to be able to tell it's CGI programs how to form a complete URL to themselves. If you're using apache this should be possible, though I'm unsure of the details. Probably it involves setting up multiple virtual hosts with (slightly) different configuration, depending on what ethernet interface the request is coming from. Another common solution to your problem, is to use separate internal and external DNS nameservers, so you can have the same host name resolve to different IP numbers depending on whether you're on your internal network or the external internet. (Since it's the same machine, it should have the same name.) > For example, my web pages include links such as > "/images/mycoolpic.gif". Yes. That's a fine solution. Getting PhpWiki to do that would take a bit of work, but you could try. (It may be as simple as editing lib/config.php so that SERVER_URL gets defined to the empty string. You could try that --- I'm not sure it will work, and it probably will break something (e.g. RSS RecentChanges).) As a hack, you could try setting SERVER_NAME from $_SERVER['HTTP_HOST'] (in index.php, that is). That picks up the host name from the Host: HTTP header sent by most modern browsers. (The Host: header is required by HTTP/1.1.) It may not work with a few rather old browsers. Something like: if (isset($_SERVER['HTTP_HOST'])) define('SERVER_NAME', $_SERVER['HTTP_HOST']); else define('SERVER_NAME', 'pick.one.com'); // punt and hope you guess right. |