Hmm, all of those problem examples work fine for me, and I just followed the main mediawiki pages on the subject. Here are my rewrite rules:
RewriteEngine On # test if rewrite should stop for special directories RewriteRule ~$ - [F] RewriteRule #$ - [F] RewriteRule ^(images|skins|mailman|pipermail)/ - [L] # all php scripts. RewriteRule .php$ - [L] # do the rewrite RewriteRule ^/?(.*)$ /index.php?title=$1 [L,QSA]
See any problems?
Assuming this doesn't have big unfixable problems (and if it does we should update the mediawiki doc pages on this subject), I would definitely say it's worth the trouble because a) it wasn't much trouble, and b) it's just so nice to have the squeaky clean URLs.
Anyway, I'm still a long way from figuring out how to do the log analysis given my current situation, anybody got any ideas on that? If not, I guess I can just look at the hits and grind out a zillion regexps that cut it down to just the pages. I was just hoping somebody had already been through this. :)
Thanks, Chris
David Gerard wrote:
On 05/01/2008, Roan Kattouw roan.kattouw@home.nl wrote:
Chris Hecker schreef:
Also, if the wiki was in a subdir, then all of the css/js stuff and images would also be there, right, so I'd have the same problem. Or are you saying use rewrite to put only the index.php?title= queries into a virtual subdir? It doesn't really matter, because I can't change that now, but I'm curious.
The point is that you redirect e.g. /wiki/Main_Page to /w/index.php?title=Main_Page . CSS/JS stuff is in /w/skins/ , and is not affected by the pretty URL stuff. You can easily set up this scheme in Apache by adding "Alias /wiki /w/index.php" (without the quotes) to httpd.conf. The disadvantages of redirecting /Main_Page to /index.php?title=Main_Page is that you have to write your RewriteRules well: you don't want "index.php?title=Main_Page" to be interpreted as a page name, resulting in an infinite loop. Also, you have to watch out for /api.php , /skins/ and /images . It's possible, but it's more trouble than it's worth.
I had to do something like this recently - a page at internal.foo.com/ that was supposed to have a wiki hanging off it at internal.foo.com/wiki - meaning the main page was internal.foo.com/wiki/Main_Page and *not* internal.foo,com/ itself. This URL arrangement was out of my hands, so I had to somehow make this thing work.
(Now they've discovered wikis are cool(tm) and are considering making internal.foo.com/ be the wiki Main_Page after all ...)
I eventually wrote some insanely complicated rewrite rules :-) They looked a bit like:
Everyone ends up with a twisty maze of little rewrite rules, all different, but you can do most of the awful things you may have to.
- d.