Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
857 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.

question from:https://stackoverflow.com/questions/65854868/sidebar-links-are-not-relative-to-wgserver

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

1 Answer

0 votes
by (71.8m points)

Simply write

* Kids|Children

or

* Kids|Kids

The same applies to wiki pages: links to other pages in the same wiki should be [[Kids|children]] or [[Kids]], and not [http://192.158.17.118/mediawiki-1.35/index.php/Kids Kids].


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...