Jimmy T.
Jimmy T.

Reputation: 4190

Determine article path of a MediaWiki installation

How can I reliable determine the article path ($wgArticlePath) of a wiki using MediaWiki when I only know the domain of the wiki?

I made some research but only found ways to find that out in own installations, not installation I have no control of.

Methods I came up with so far but doesn't always seem to work:

Upvotes: 1

Views: 122

Answers (1)

leo
leo

Reputation: 8520

You can get the article path from the API, using action=query&meta=siteinfo. The article path is included in a bunch of properties called “general”. An example from English Wikipedia, querying for the general properties only:

https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=general

In this case, you will find: "articlepath": "/wiki/$1"

If you do not even know the path to the API, you can parse the markup of the starting page (or any page), and look for a <link rel="EditURI"> tag in the header. You will find this on any default installation of a fairly recent MediaWiki version (though it would obviously be perfectly possible to remove this tag through the use of some extension).

Upvotes: 2

Related Questions