Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

mediawiki - sidebar links are not relative to wgServer

I have a personal wiki running on Ubuntu at work, and at home. I keep the two in sync via script files that copy files (mediawiki folder and mysql folder) from the work wiki to a Dropbox folder. I then copy the changed files down to the home wiki machine (and vice versa). This has worked really well...until now.

The work wiki is at http://192.158.17.118/mediawiki-1.35/index.php/Main_Page

The home wiki is at http://192.167.12.128/mediawiki-1.35/index.php/Main_Page

The different base ip addresses has not been a problem until now because I have the following in my LocalSettings.php to set wgServer dynamically.

## The protocol and server name to use in fully-qualified URLs
#$wgServer = "http://192.158.17.118";
$wgServer = WebRequest::detectServer();

Now, I made a change to my sidebar menu to insert a couple of links to pages down in my wiki. The problem is that these new links are not constructed relative to the dynamic wgServer ip address:

For example, one link has this URL on BOTH the home and work wiki (after I sync): http://192.158.17.118/mediawiki-1.35/index.php/Kids

How can I change the http://192.158.17.118 part of the link so it is dynamically recognized regardless of the ip address of the wiki?

p.s. I'm running the wiki's on Ubuntu Mate 20.10 (Groovy Gorilla) on VMware Workstation 16 Pro on Win 10 Pro machines. VMware Workstation hands out ip addresses to the virtual clients and it looks pretty well awful to try and set a static for a client. I'd much rather find a nice wiki solution.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...