Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...