Add me to the list of folks pulling their hair out trying to get prettier urls to work with mediawiki.
After upgrading to 1.4.0 I decided to try to prettify my urls. I hadn't tried actually rewriting the incoming urls using mod_rewrite under my previous 1.3.x installation, but I swear that manually entering a url of .../wiki/index.php/Title used to work.
I've set up rewrite rules for the wiki directory, and It looks like the rewriting of a url like
http://www.mydomainname/wiki/Frodo to http://www.mydomainname/wiki/index.php/Frodo
is working but then the url itself isn't being properly processed. As I say, before I upgraded to 1.4.0 manual use of the resulting url used to work.
Yesterday, I couldn't get the alternative of rewriting to
http://www.mydomainname/wiki/index.php?Frodo
to work either, but today, for some mysterious reason it seems to work.
I hate it when things don't work and I don't understand why, but I hate it even more when they start to work and I still don't understand why, since it's not good for the confidence in things not breaking in the future.
Anyway, any ideas why the index.php/articlename form used to work in 1.3 and doesn't in 1.4?
On 23 Mar 2005, at 12:38, Rick DeNatale wrote:
Add me to the list of folks pulling their hair out trying to get prettier urls to work with mediawiki.
I'm assuming you're using Apache, and have access to at least an included portion of httpd.conf.
Have you tried using Alias instead of RewriteRule?
I tried both under 1.4b5, and found Alias was slightly faster, and MUCH easier to understand. The RewriteRule technique may have some advantage I don't understand, which probably means I don't need it!
I have not tried it under 1.4 yet. I had to disable it in order to get at the config directory -- another good thing about pretty URLs. (And also, it's more likely to get crawled -- a mixed blessing.)
:::: We're in a giant car heading toward a brick wall at a hundred miles an hour, arguing over who has the best seat. -- David Suzuki :::: Jan Steinman http://www.Bytesmiths.com/Van
Quoting Jan Steinman, from the post of Wed, 23 Mar:
Have you tried using Alias instead of RewriteRule?
I tried both under 1.4b5, and found Alias was slightly faster, and MUCH easier to understand. The RewriteRule technique may have some advantage I don't understand, which probably means I don't need it!
well, it is definitely faster and offeres less pitfalls than the all-powerful mod_rewrite, but there's one thing it won't do (correct me if wrong!) - it won't let you use page names in the root, i.e. get rid of the /w/ or /wiki/ or what have you. I think I raised that once.
I'm not saying your setup is bad ofcourse, it's a misfeature in Apache...
Rick DeNatale wrote:
I've set up rewrite rules for the wiki directory, and It looks like the rewriting of a url like
http://www.mydomainname/wiki/Frodo to http://www.mydomainname/wiki/index.php/Frodo
That's a bad idea; covering the real wiki files with a virtual rewrite area usually leads to conflicts and loops. You should *always* keep the rewrite areas at separate locations from your real files (for instance we have /wiki and /w on Wikipedia).
is working but then the url itself isn't being properly processed. As I say, before I upgraded to 1.4.0 manual use of the resulting url used to work.
Can you describe what's going wrong? Is there an error message? Wrong page? Failure to load? Anything in the error logs?
Yesterday, I couldn't get the alternative of rewriting to
This would never work. Try: index.php?title=Frodo
Anyway, any ideas why the index.php/articlename form used to work in 1.3 and doesn't in 1.4?
Did you change your PHP installation from the apache 1.x module or apache2handler module to CGI, FastCGI, or apache2filter?
Can you confirm that you don't have some other problem?
Have you made sure that you're not rewriting the skin files into wiki pages or some other problem?
-- brion vibber (brion @ pobox.com)
On Wed, 23 Mar 2005 13:10:32 -0800, Brion Vibber brion@pobox.com wrote:
Rick DeNatale wrote:
I've set up rewrite rules for the wiki directory, and It looks like the rewriting of a url like
http://www.mydomainname/wiki/Frodo to http://www.mydomainname/wiki/index.php/Frodo
That's a bad idea; covering the real wiki files with a virtual rewrite area usually leads to conflicts and loops. You should *always* keep the rewrite areas at separate locations from your real files (for instance we have /wiki and /w on Wikipedia).
Okay, although I don't have any loop. Just so I understand you are suggesting that since the wiki is installed at .../wiki I should use urls of the form .../w/PageTitle and rewrite them to .../wiki/index.php/PageTitle
is working but then the url itself isn't being properly processed. As I say, before I upgraded to 1.4.0 manual use of the resulting url used to work.
Can you describe what's going wrong? Is there an error message? Wrong page? Failure to load? Anything in the error logs?
I'm just getting a 404 Object Not Found http reply and the error log has an entry File does not exist: /var/www/html/wiki/index.php/Astronaut:John_Glenn
where Astronaut:John Glenn is the article title. http://www.denhaven2.homeip.net/wiki/index.php?Astronaut:John Glenn works fine.
Yesterday, I couldn't get the alternative of rewriting to
This would never work. Try: index.php?title=Frodo
Yeah, that was just a typo in my posting. I was rewriting it to ?title=...
Anyway, any ideas why the index.php/articlename form used to work in 1.3 and doesn't in 1.4?
Did you change your PHP installation from the apache 1.x module or apache2handler module to CGI, FastCGI, or apache2filter?
I haven't changed anything, Apache and php are both from the RH9 distro plus maintenance patches.
I noticed in the config/index.php script that php_sapi_name was being checked in the install, so I put a little php test file in my document root:
<?php $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { echo "You are using CGI PHP\n"; } else { echo "You are not using CGI PHP\n"; } ?>
Pointing my web browser to this (via Apache) reports:
sapi name is apache2filter
And this seems to turn off pretty URLS. Is this a difference between 1.3 and 1.4?
Is this something which I can change? I know very little about configuring PHP.
Can you confirm that you don't have some other problem?
I'm sure that I have many <G>
Have you made sure that you're not rewriting the skin files into wiki pages or some other problem?
No the RewriteConds seem to be working correctly according to the rewrite log at level 9
On Wed, 23 Mar 2005 17:18:21 -0500, Rick DeNatale rick.denatale@gmail.com wrote:
On Wed, 23 Mar 2005 13:10:32 -0800, Brion Vibber brion@pobox.com wrote:
Rick DeNatale wrote:
<?php $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { echo "You are using CGI PHP\n"; } else { echo "You are not using CGI PHP\n"; } ?>
Oops, that's the script I used as an example, the one I wrote just dumped out the raw output of php_sapi_name()
Rick DeNatale wrote:
Okay, although I don't have any loop. Just so I understand you are suggesting that since the wiki is installed at .../wiki I should use urls of the form .../w/PageTitle and rewrite them to .../wiki/index.php/PageTitle
You could if you want. On Wikipedia we have /w/index.php and /wiki/Foo.
I'm just getting a 404 Object Not Found http reply and the error log has an entry File does not exist: /var/www/html/wiki/index.php/Astronaut:John_Glenn
where Astronaut:John Glenn is the article title. http://www.denhaven2.homeip.net/wiki/index.php?Astronaut:John Glenn works fine.
[snip]
Pointing my web browser to this (via Apache) reports:
sapi name is apache2filter
apache2filter doesn't allow you to use the PATH_INFO extra information (eg index.php/Foo). If you try, you get a 404 error.
And this seems to turn off pretty URLS. Is this a difference between 1.3 and 1.4?
No, nothing's changed wrt that. That wouldn't have worked in 1.3 or 1.2 either with apache2filter.
Is this something which I can change? I know very little about configuring PHP.
Reinstall PHP with apache2handler selected as the SAPI if you want index.php/Foo to work. See PHP documentation on configuring and compiling PHP.
-- brion vibber (brion @ pobox.com)
"Rick" == Rick DeNatale rick.denatale@gmail.com writes:
Add me to the list of folks pulling their hair out trying to get prettier urls to work with mediawiki.
Take a look at how I did it:
http://wiki.wegge.dk/MediaWiki_customizations
But beware, this way of doing things can lead to endless redirect loops, so don't do it unless you can monitor the access_log regularly.
mediawiki-l@lists.wikimedia.org