Kind of a newbie question... I'm not even sure of the appropriate taxonomy for my request, maybe that's why Google didn't help.
Using last stable (1.16.2 I believe), I'm trying to achieve this:
Got a default setup, Mediawiki installed in /w, Apache conf edited with an Alias. So now my wiki is accessible at http://domain.tld/wiki/
I would like to link a specific namespace (let's say "bar") to its own URL, outside of /foo/.
Ok, to rephrase, hopefully better:
I would like: domain.tld/wiki/Bar:SomePage to be in fact: domain.tld/Bar/SomePage
And if Apache could rewrite on the client side /wiki/Bar:SomePage into /Bar/SomePage that would be even better, albeit not a deal breaker.
Without breaking anything in MW of course. And if the Recent or Search tool return the Bar:SomePage that's not an issue, I don't want to rewrite the MW core :)
Anyone got an idea?
On 11-04-06 04:35 PM, Dorem - Jérémie Bouillon wrote:
Kind of a newbie question... I'm not even sure of the appropriate taxonomy for my request, maybe that's why Google didn't help.
Using last stable (1.16.2 I believe), I'm trying to achieve this:
Got a default setup, Mediawiki installed in /w, Apache conf edited with an Alias. So now my wiki is accessible at http://domain.tld/wiki/
I would like to link a specific namespace (let's say "bar") to its own URL, outside of /foo/.
Ok, to rephrase, hopefully better:
I would like: domain.tld/wiki/Bar:SomePage to be in fact: domain.tld/Bar/SomePage
And if Apache could rewrite on the client side /wiki/Bar:SomePage into /Bar/SomePage that would be even better, albeit not a deal breaker.
Without breaking anything in MW of course. And if the Recent or Search tool return the Bar:SomePage that's not an issue, I don't want to rewrite the MW core :)
Anyone got an idea?
Rewrites are a remote possibility, though they're a horrendously ugly way to do that.
Though... ;) you do make me want to implement something like that as a feature. We should at least have a hook to allow some mutation of how mw extracts titles from paths.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
On 07/04/2011 02:04, Daniel Friesen wrote:
Though... ;) you do make me want to implement something like that as a feature.
:-)
I'm sure I'm not the only one. In fact I have a wiki to handle some specific KB about a specific subjet covered by the website, but I also want the wiki to handle the site's help and documentation (under a different namespace, with a different URL).
I can imagine several websites or scenarios willing to do the same.
I thought about rewrite rules, but as you say seems ugly and heavy. I also thought about setting up a second wiki using the first one base, but that become complicated... I already planned to use external auth, add to that centralised search, centralized surveillance, user management and rights... seems better to just do it in one install.
2011/4/6 Dorem - Jérémie Bouillon jeremie@dorem.info
I would like to link a specific namespace (let's say "bar") to its own URL, outside of /foo/.
Ok, to rephrase, hopefully better:
I would like: domain.tld/wiki/Bar:SomePage to be in fact: domain.tld/Bar/SomePage
I think the best way to do this would be to whip up an extension using the 'GetLocalURL' hook to change the URLs that MediaWiki outputs when they look clean (no extra query params etc).
Setting up Apache rewrite rules to translate your custom URLs back to index.php?title=Blah form should handle the other side of things, so MediaWiki understands the incoming URLs.
For general info on extensions & writing them see: http://www.mediawiki.org/wiki/Manual:Extensions and http://www.mediawiki.org/wiki/Manual:Developing_extensions -- a simple extension can just be one function so it's not too intimidating really. :)
-- brion
On 07/04/2011 02:07, Brion Vibber wrote:
I think the best way to do this would be to whip up an extension using the 'GetLocalURL' hook to change the URLs that MediaWiki outputs when they look clean (no extra query params etc).
I think I understand the theory, what you mean.
For general info on extensions& writing them see: http://www.mediawiki.org/wiki/Manual:Extensions and http://www.mediawiki.org/wiki/Manual:Developing_extensions -- a simple extension can just be one function so it's not too intimidating really. :)
You haven't see what I can write with PHP... it's both intimidating and I'll probably add numerous security holes everywhere :p
2011/4/6 Dorem - Jérémie Bouillon jeremie@dorem.info
On 07/04/2011 02:07, Brion Vibber wrote:
I think the best way to do this would be to whip up an extension using
the
'GetLocalURL' hook to change the URLs that MediaWiki outputs when they
look
clean (no extra query params etc).
I think I understand the theory, what you mean.
For general info on extensions& writing them see: http://www.mediawiki.org/wiki/Manual:Extensions and http://www.mediawiki.org/wiki/Manual:Developing_extensions -- a simple extension can just be one function so it's not too intimidating really.
:)
You haven't see what I can write with PHP... it's both intimidating and I'll probably add numerous security holes everywhere :p
hehehehe :D Luckily it really is not much code, lemme whip up an example...
You could add this to your LocalSettings.php:
$wgHooks['GetLocalURL'][] = 'efMyCustomLinks'; function efMyCustomLinks( $title, &$url, $query ) { if (!$query && $title->getNamespace() == NS_PROJECT) { // Rewrite clean links to pages in this namespace // Needs mod_rewrite rules or something to match! $url = '/proj/' . wfUrlEncode( $title->getDBKey() ); } return true; }
The main things you want to customize here are which namespace id key it compares against (the numeric key, so whatever you're adding to $wgExtraNamespaces or one of the standard namespace name constants like NS_USER, NS_TALK etc) and of course the actual output path.
In the Apache rewrite rules, don't forget to add back the namespace prefix ('Foo:' or whatever)!
-- brion
On 07/04/2011 02:42, Brion Vibber wrote:
hehehehe :D Luckily it really is not much code, lemme whip up an example...
Thanks a lot (again, even after a couple of months), works even better that I suspected.
In the Apache rewrite rules, don't forget to add back the namespace prefix ('Foo:' or whatever)!
However, I'm stuck here.
I tried both Redirect (mod_alias) and rewrite rules, but each time I manage to have something that works (no HTTP 404), my browser URL is set back to the default one.
I.e. I have domain.tld/wiki/ for the regular wiki access (main NameSpace and everything else).
And I have a specific custom NameSpace that I would like to access through domain.tld/doc/.
Right now, everything I try rewrite domain.tld/doc/ -> domain.tld/wiki/
And I don't know where it's coming from (either my Apache rules not good enough, or not in the right order; or MW itself).
Anyone got an idea?
Dorem - Jérémie Bouillon wrote:
I.e. I have domain.tld/wiki/ for the regular wiki access (main NameSpace and everything else).
And I have a specific custom NameSpace that I would like to access through domain.tld/doc/.
Right now, everything I try rewrite domain.tld/doc/ -> domain.tld/wiki/
And I don't know where it's coming from (either my Apache rules not good enough, or not in the right order; or MW itself).
Anyone got an idea?
It's the wiki doing it for you. Don't link to /wiki/ since it redirects to /wiki/Main_Page
For your .htaccess RewriteEngine on RewriteRule ^doc/$ /w/index.php?title=Docs:Documentation_index [L] RewriteRule ^doc/(.*)$ /w/index.php?title=Docs:$1 [L]
You can see a similar "partial wiki" at http://www.wikilm.es/ (they are all subpages of Wiki_Loves_Monuments at the normal wiki). There was no attempt to hide part of the page name in the links, although there are some hacks for supporting the multiple languages.
On 29/07/2011 01:04, Platonides wrote:
It's the wiki doing it for you. Don't link to /wiki/ since it redirects to /wiki/Main_Page
For your .htaccess RewriteEngine on RewriteRule ^doc/$ /w/index.php?title=Docs:Documentation_index [L] RewriteRule ^doc/(.*)$ /w/index.php?title=Docs:$1 [L]
Thanks a lot, but it loops on the NS index.
I got this:
RewriteRule ^documentation/$ /w/index.php?title=Docs:Documentation_index [L] RewriteRule ^documentation/(.*)$ /w/index.php?title=Docs:$1 [L]
Works for every page, except Accueil (which is Main_page in French Mediawiki).
http://domain.tld/documentation/Accueil or http://domain.tld/documentation/
is rewritten to http://domain.tld/documentation/Accueil/Accueil/Accueil/Accueil/Accueil/Accu...
It seems to come from MW, since Apache does not log an error (not even a 404, nor a loop). It's MW that says "Documentation:Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/" does not exist, would you like to create it, and so on.
I tried to look the MW manual for Namespace_index command, see how its handled, no luck.
Messieurs, J'ai lu avec intérêt le Message ci-dessous. Je l'ai enregistré dans le "Bloc-notes" que je tiens sur les déboires de "Mediawiki" ! Les Causes de ces ennuis me semblent profondes, et donc je n'ai plus compétence pour aider à les résoudre ! Mais cela montre bien que, si il arrive à des Industriels du Logiciel de Vendre des Progiciels qui s'avèrent ne pas être au point, les Adeptes du "Logiciel Libre" risquent de contraindre ceux qui ne souhaitent que les Utiliser, comme c'est mon cas, comme Ressources de Base, pour en Créer d'Autres, comme, pour mon cas, des "Terminologies" et "Ontologies", qui, elles, seront aussi mais ensuite seulement, disponibles, ici en Science des Systèmes, à des Tripatouillages risqués, et qu'ils ne peuvent assumer ! J'espère que les Responsables de "Mediawiki" et donc les Intervenants dans son Développement, m'informeront de la disponibilité d'une Version Mature et Portable, fonctionnant aussi bien sous Windows XP et suivants, que sous LINUX et consorts ! Désolé de ne pouvoir participer davantage ! Eric Beaussart. J'envoie Copie pour info à Monsieur Bricage, Webmestre de "Ressystemica" qui m'a suggéré "Mediawiki" comme Outil, et à Monsieur Loïc Lauréote, Ingénieur Informaticien, Adepte des Logiciels Libres, qui m'a aidé un temps à en faire fonctionner sur ma machine !
Message du 29/07/11 02:35 De : "Dorem - Jérémie Bouillon" A : "MediaWiki announcements and site admin list" Copie à : Objet : Re: [Mediawiki-l] Different URL path for different namespace?
On 29/07/2011 01:04, Platonides wrote:
It's the wiki doing it for you. Don't link to /wiki/ since it redirects to /wiki/Main_Page
For your .htaccess RewriteEngine on RewriteRule ^doc/$ /w/index.php?title=Docs:Documentation_index [L] RewriteRule ^doc/(.*)$ /w/index.php?title=Docs:$1 [L]
Thanks a lot, but it loops on the NS index.
I got this:
RewriteRule ^documentation/$ /w/index.php?title=Docs:Documentation_index [L] RewriteRule ^documentation/(.*)$ /w/index.php?title=Docs:$1 [L]
Works for every page, except Accueil (which is Main_page in French Mediawiki).
http://domain.tld/documentation/Accueil or http://domain.tld/documentation/
is rewritten to http://domain.tld/documentation/Accueil/Accueil/Accueil/Accueil/Accueil/Accu...
It seems to come from MW, since Apache does not log an error (not even a 404, nor a loop). It's MW that says "Documentation:Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/Accueil/" does not exist, would you like to create it, and so on.
I tried to look the MW manual for Namespace_index command, see how its handled, no luck.
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Eric BEAUSSART a écrit:
Messieurs, J'ai lu avec intérêt le Message ci-dessous. Je l'ai enregistré dans le "Bloc-notes" que je tiens sur les déboires de "Mediawiki" ! Les Causes de ces ennuis me semblent profondes, et donc je n'ai plus compétence pour aider à les résoudre ! Mais cela montre bien que, si il arrive à des Industriels du Logiciel de Vendre des Progiciels qui s'avèrent ne pas être au point, les Adeptes du "Logiciel Libre" risquent de contraindre ceux qui ne souhaitent que les Utiliser, comme c'est mon cas, comme Ressources de Base, pour en Créer d'Autres, comme, pour mon cas, des "Terminologies" et "Ontologies", qui, elles, seront aussi mais ensuite seulement, disponibles, ici en Science des Systèmes, à des Tripatouillages risqués, et qu'ils ne peuvent assumer ! J'espère que les Responsables de "Mediawiki" et donc les Intervenants dans son Développement, m'informeront de la disponibilité d'une Version Mature et Portable, fonctionnant aussi bien sous Windows XP et suivants, que sous LINUX et consorts ! Désolé de ne pouvoir participer davantage ! Eric Beaussart. J'envoie Copie pour info à Monsieur Bricage, Webmestre de "Ressystemica" qui m'a suggéré "Mediawiki" comme Outil, et à Monsieur Loïc Lauréote, Ingénieur Informaticien, Adepte des Logiciels Libres, qui m'a aidé un temps à en faire fonctionner sur ma machine !
MediaWiki marches perfectement avec une instalation normale, sur Windows, Linux, Mac et autres. Le source des problémes de Jérémie est qui'il ne veux pas de utiliser les urls normales de MediaWiki mais autre systeme.
It was a small project so my boss let me spend a few hours implementing this.
MediaWiki 1.19 now has a few extra hooks that make altering the title extraction pattern possible from extensions. I added a NamespacePaths extension that should do what you want. http://www.mediawiki.org/wiki/Extension:NamespacePaths
You should be able to backport the changes made in r94373 to your own copy of MediaWiki and install the extension. You'll have to patch one or two versions of MediaWiki with a small set of hooks, but when you get to 1.19 you won't need to anymore.
For the .htaccess stuff, just rewrite things to your /index.php and the REQUEST_URI extracting code will handle the rest.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] ~Redwerks: http://redwerks.org/
On 11-04-06 04:35 PM, Dorem - Jérémie Bouillon wrote:
Kind of a newbie question... I'm not even sure of the appropriate taxonomy for my request, maybe that's why Google didn't help.
Using last stable (1.16.2 I believe), I'm trying to achieve this:
Got a default setup, Mediawiki installed in /w, Apache conf edited with an Alias. So now my wiki is accessible at http://domain.tld/wiki/
I would like to link a specific namespace (let's say "bar") to its own URL, outside of /foo/.
Ok, to rephrase, hopefully better:
I would like: domain.tld/wiki/Bar:SomePage to be in fact: domain.tld/Bar/SomePage
And if Apache could rewrite on the client side /wiki/Bar:SomePage into /Bar/SomePage that would be even better, albeit not a deal breaker.
Without breaking anything in MW of course. And if the Recent or Search tool return the Bar:SomePage that's not an issue, I don't want to rewrite the MW core :)
Anyone got an idea?
mediawiki-l@lists.wikimedia.org