[pmwiki-users] pmwiki mirrors

Petko Yotov 5ko at 5ko.fr
Mon Mar 29 02:19:27 PDT 2021

Yes, it is possible, I use this on a number of websites -- either a home 
server like your case, or a "backup snapshot" of a website from the 
previous night.

To do it, you can have in config.php a conditional based on the server 
name or the server address.

It will help if you have the same server software (e.g. Apache) and PHP 
version on both installations, or have slightly newer versions at home.

You don't need to use relative links, you need to define different 
values to the $EnableReadOnly, $ScriptUrl, $FarmPubDirUrl, $PubDirUrl, 
and $UploadUrlFmt variables.

   if($_SERVER['SERVER_ADDR'] == '') { # home server
     # or possibly $_SERVER['SERVER_NAME'] == "localhost"
     $ScriptUrl = "";
     $FarmPubDirUrl = $PubDirUrl = "";
     $UploadUrlFmt = "";

     # this is to remind me I am on the home server
     $HTMLStylesFmt['Local'] = '#wikitext {background-color: #ffe 
     $WikiTitle = 'Local wiki';
   else { # online server
     $EnableReadOnly = 1;

     $ScriptUrl = "https://www.your-website.org/wiki/";
     $FarmPubDirUrl = $PubDirUrl = 
     $UploadUrlFmt = ""https://www.your-website.org/wiki/uploads";

     $WikiTitle = 'Online wiki';

I believe there are some aggressive caching recipes that you may have to 
disable, or to skip the *,cache files from the home server when you 

The next step may be to have a static export and rsync that to the 
online server (although, no search, authentication, PmWiki conditionals, 
{(ftime)} markup expressions or other interactive server-side features). 
Static export is not an easy task though.


On 29/03/2021 10:46, jdd at dodin.org wrote:
> I would like to have a pmwiki mirror at home, where I have a local 
> server.
> May main site is on a shared server and is sometime very difficult to
> use due to excessive load on this server and I want to make the
> editing on my own network and rsync the result to the online shared
> server.
> my own local server may also be unavailable in case of power failure
> (not that rare nowadays here).
> But for this to works, I have to use relative links all over the wiki
> pages as of course the domain name of the two servers will not be the
> same. for example in local/config.php
> is this possible without breaking pmwiki?
> is it possible to make the online pmwiki read only for the web server
> (of course not for rsync :-)?

More information about the pmwiki-users mailing list