[pmwiki-users] using several domains

Petko Yotov 5ko at 5ko.fr
Sat Mar 25 12:05:35 CDT 2017


On 2017-03-25 17:09, jdd wrote:
> Le 25/03/2017 à 11:44, Petko Yotov a écrit :
>> On 2017-03-25 11:29, jdd wrote:
>>> apache2 is setup to accept any tld (org, info or me), but some of the
>>> addresses in pmwiki (external ones) are not
>>> 
>>> is there a variable that gives only the domain name?
>> 
>> Yes: $_SERVER['HTTP_HOST']
>> 
> 
> sorry, but I can't use it :-(
> 
>  [[{*$FullName}]]
> 
> prints the page name
> 
>  [[{*$_SERVER['HTTP_HOST'}]]
> 
> prints only the text and a ?
> I can't neither make work the example of this page ($PubDirUrl)

Both these are PHP variables to be used in config.php, not PmWiki 
PageVariables to be used in a wiki page.

For a wiki page, it is easy to use the Path: links, see below:

> so, for example, an url could be http://{domainname}/data/file and open
> on the original site as http://dodin.org/data/file and on the new one 
> as
> http://dodin.me/data/file

Here I would use [[Path:/data/file]].

If you require printing the domain name into the wiki page, you can add 
a page variable. In config.php:

   $FmtPV['$DomainName'] = '$_SERVER["HTTP_HOST"]';

Then in the wiki page type {$DomainName}.

This contains only the domain name, you need to add "http://" to make a 
link.


In most cases you should not need to set $PubDirUrl, leave it as it is, 
PmWiki will configure it correctly.

If for some reason it is incorrect, for your case I'd set it as a 
relative (no domain name) variable in config.php:

   $PubDirUrl = "/wiki/pub";

Or, you could set it with the domain name:

   $PubDirUrl = "http://{$_SERVER['HTTP_HOST']}/wiki/pub";

Petko



More information about the pmwiki-users mailing list