[pmwiki-users] double server?

Petko Yotov 5ko at 5ko.fr
Sun May 24 04:17:56 PDT 2020


It is likely that config.php has defined some variables to the old 
domain.

The easiest fix may be in config.php to simply comment out or delete the 
definitions of $PubDirUrl and/or $FarmPubDirUrl if they exist.

If this is not enough, then PmWiki is incapable to detect the correct 
URLs, and you can set them to the correct domain:

  $FarmPubDirUrl = "https://www.example.org/pmwiki/pub";
  $PubDirUrl = "https://www.example.org/field/pub";

The values are the URL path reachable via browser to the "pub" 
directory, under which there will be "skins/yourskinname/skin.css". You 
can usually see this path in the html source of any page on the new 
domain in a <link...> tag:

   <link rel='stylesheet' href='__URL_HERE__/skins/yourskinname/skin.css' 
/>

and you need to take the part preceding "/skins/yourskinname/...". (And 
use the new domain name.)

You shouldn't need to manually set $SkinDirUrl.


If you have incoming visitors to http://oldwww.etc (not https: which 
will likely fail) you can redirect them to the new domain.

Best is to redirect from the old to the new via .htaccess at the 
document root. I use something like this on a few domains:

   RewriteEngine On

   # Redirect oldwww.example.org to www.example.org
   # Also redirect http to https
   RewriteCond %{HTTPS} off [OR]
   RewriteCond %{HTTP_HOST} ^oldwww\.example\.org [NC]
   RewriteRule (.*) https://www.example.org%{REQUEST_URI} [R=303,L]


With Apache 2.4 or newer you may be able to use (note the quotes):

   <If "%{HTTP_HOST} == 'oldwww.example.com'">
     Redirect permanent "/" "https://www.example.com/"
   </If>

Both these depend on what is allowed in .htaccess on the server.


Within PmWiki, you can also redirect, early in config.php:

   # this will redirect oldwww.example.org,
   #   example.org or other to www.example.org
   if($_SERVER['HTTP_HOST'] != 'www.example.org' || $UrlScheme != 
'https') {
     Redirect($pagename, 
"https://www.example.org".$_SERVER['REQUEST_URI']);
     exit;
   }



Petko

-- 
If you upgrade :  http://www.pmwiki.org/Upgrades


On 24/05/2020 12:06, James M wrote:
> I have a strange set up at work - our web pages (in particular my 
> pmwiki)
> is served by 2 web servers (apache I believe), one called www.etc and 
> the
> other oldwww.etc.  I don't have access to the servers, and the IT 
> people
> who do are unresponsive (presumably, to give them the benefit of the 
> doubt,
> the coronavirus issues are producing a lot of extra work).
> 
> Anyway, the www.etc works fine.  But the oldwww.etc has an expired
> certificate and my browsers don't load the pages when directed to that
> server.  For some reason, the servers are set up so that $SkinDirUrl 
> become
> oldwww.etc/my-wiki-address rather than www.etc/my-wiki-address.
> 
> The short question is, how can I tell $SkinDirUrl explicitly to use
> www.etc?  Perhaps also $ScriptUrl?  I'm not sure exactly which 
> variables I
> need to set.  When I look at the source, it seems to be only the skin 
> pages
> that are called via oldwww.etc.



More information about the pmwiki-users mailing list