[pmwiki-users] host-independent URLs for configurations
Patrick R. Michaud
pmichaud at pobox.com
Tue Mar 15 17:23:00 CST 2005
On Tue, Mar 15, 2005 at 12:13:00PM -0500, Bronwyn Boltwood wrote:
> I'm migrating and splitting a v1 wiki into a v2 farm with 2 fields.
> This process is being made a little more painful by some things that I
> want to do. (These include clean URLs, but that's another post.)
>
> 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?
Well, in general you can get the base server URL by doing the
following:
$BaseUrl = 'http://' . $_SERVER['HTTP_HOST'];
However, I'm guessing there must be some reason this doesn't work for
you. In that case, the easiest thing to do is to create special .php
files that hold any machine-specific settings, and include them from
config.php. For example, in your local/config.php you could put:
include_once('../machine.php');
and then create a machine.php file in the directory above "pmwiki"
on each of your systems that makes any machine-specific settings.
Copying the pmwiki directory from your local machine to your
webserver won't overwrite ../machine.php, so those settings would
remain without you having to change them.
As far as farmmap.txt is concerned, you can also create more
InterMap text file locations -- just add:
$InterMapFiles[] = '../machinemap.txt';
into your config.php and it will load entries from ../machinemap.txt
in addition to the normal intermap.txt files.
Pm
More information about the pmwiki-users
mailing list