[Mediawiki-l] Losing the index.php

Patrick Atoon patricka at rapdict.org
Tue Nov 30 23:10:08 UTC 2004


Howdy,

I've been experimenting with RewriteRules and LocalSettings.php
to get rid of the "index.php" in the URL, but I'm running into
unexpected problems.

The setup now seems to work using:

---- LocalSettings.php ----------------------------------
$wgScriptPath       = "";
$wgScript           = $wgScriptPath . "/index.php";
---------------------------------------------------------

"Seems", because there is a strange balance between Apache and
PHP keeping the "index.php" most of the time out of the URL. The
correct setup would be:

---- LocalSettings.php ----------------------------------
$wgScriptPath       = "";
$wgScript           = "";
---------------------------------------------------------

but this causes an infinite "Error 302 Moved Temporarily" loop
(Using Firefox, Apache 2.0.52, Squid 2.5 and Mediawiki 1.3.8) for
the URL in the script tag on each page:

   <script src="?title=-&amp;action=raw&amp;gen=js&amp;smaxage=0"
   type="text/javascript"></script>

It looks like the empty $wgScript causes the mayhem in the
function getLocalURL() in Title.php (via Skin.php and SkinPHPTal.php).
The code looks sensible, though.

My RewriteRules look like this:

---- httpd.conf -----------------------------------------
RewriteEngine On

# Redirect old /wiki/ urls
RewriteRule ^/wiki/(.*)$ http://www.rapdict.org/$1 [R,L]

RewriteRule ^/index.php/(.*)$ http://www.rapdict.org/$1 [R,L]

# Don't rewrite requests for files in MediaWiki subdirectories,
# MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt
RewriteCond %{REQUEST_URI} !^/(stylesheets|images|skins)/
RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/robots.txt

# Rewrite http://wiki.domain.tld/article properly, this is the main rule
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
---------------------------------------------------------

Does anyone know how to counter the infinite 302 loop for that script
URL?

Greetings,

Patrick

-- 
_______________________________________________________________
   Patrick Atoon ___________________ mailto:patricka at rapdict.org
   _____________________________________ http://www.rapdict.org/



More information about the MediaWiki-l mailing list