[pmwiki-users] host-independent URLs for configurations

Radu radu at monicsoft.net
Tue Mar 15 15:20:00 CST 2005


Here's what I do. Hackish, I know, but it works:

Inside local/config.php, before any $...Url variables are declared

if(($sn=$_SERVER['SERVER_NAME'])=='127.0.0.1'){
  ...stuff for the config locally...
}else{
  ...stuff for config somewhere else...
}

the $sn variable I use inside both configs as a domain name for urls, like:

$ScriptUrl = "http://$sn/pmwiki/";

You can use localhost instead of 127.0.0.1.

At 12:13 PM 3/15/2005, you wrote:
>Problem: several configuration things want URLs, such as farmmap.txt
>and config.php.  Well, on the webserver they start with
>"http://arndis.godsong.org", and on my machine they start with
>"http://localhost".  Changing them back and forth is a nuisance.  Is
>there something I can do to tell these to use the base URL plus
>whatever, and to get the base URL from the server?  What file would I
>put that information in?

Cheers,
Radu
(www.monicsoft.net) 




More information about the pmwiki-users mailing list