Cookbook /
UseAlternativeConfigurations
Summary: Get the base URL from the server
Version:
Prerequisites: Last tested on PmWiki version: 2.0 beta26
Status:
Maintainer:
Categories: Administration
Question
Is there something I can do to get the base URL from the server?
Answer
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/";
Instead of 127.0.0.1 you can use:
- localhost (equivalent) or
- any specific domain name or IP number to create alternative setups for various wikis/farms.
Notes and Comments
See Also
Contributors
-Radu March 15, 2005, at 03:35 PM