Mailing List Archive

Rewrite rule
I cannot seem to locate any documentation on how to properly implement
rewrite rules on MediaWiki 1.37. Can anyone point me in the right
direction?

Thanks,
Larry
Re: Rewrite rule [ In reply to ]
On Sun, 14 Nov 2004 10:24:55 -0800, Larry G. Wapnitsky
<larry@kvetsch.com> wrote:
> I cannot seem to locate any documentation on how to properly implement
> rewrite rules on MediaWiki 1.37. Can anyone point me in the right
> direction?

Well, there's http://meta.wikimedia.org/wiki/Rewrite_rules and
http://meta.wikimedia.org/wiki/Talk:Rewrite_rules on the meta-wiki
(which is where most MediaWiki-related documentation is to be found).
Then there's a whole ton of discussions and troubleshooting about it
in the archives of this list
(http://mail.wikipedia.org/pipermail/mediawiki-l/ try using a
site-specific Google search) and who knows what else somewhere else.
But, as far as I know, mod_rewrite is just far too voodoo* for anyone
to have written anything "comprehensive" or "complete", let alone
"authoritative"; so, um, good luck! ;)

[* a term even Apache's official documentation doesn't deny:
http://httpd.apache.org/docs/mod/mod_rewrite.html]

--
Rowan Collins BSc
[IMSoP]
Re: Rewrite rule [ In reply to ]
Quoting Larry G. Wapnitsky, from the post of Sun, 14 Nov:
> I cannot seem to locate any documentation on how to properly implement
> rewrite rules on MediaWiki 1.37. Can anyone point me in the right
> direction?

here's how I define the virtual server in apache. I do it in the apache
config since doing it in the .htaccess is cumbersome, puts extra load on
the server and should generally only be used by people who don't control
the apache they run under:

# Allow wiki articles to start with a period
<Files .*>
Order Deny,Allow
Allow From All
</Files>

RewriteEngine on

RewriteRule ^/index.php/(.*)$ http://${SITENAME}.org/$1 [R,L]
RewriteCond %{REQUEST_URI} !^/(stylesheets|images|config|stats)/
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

RewriteRule ^/(.*) /index.php/$1 [L]


--
Hot Stuff
Ira Abramov
http://ira.abramov.org/email/
Re: Re: Rewrite rule [ In reply to ]
I'm trying to do the rewrite right now, but am running into some problems.
For some reason, when I go to:

http://www.myhost.org/index.php/Some_Topic

this format doesn't work! The only way it works for me is with the
?title= format. (I don't use a wiki subdirectory to hold everything)

Any thoughts on why? I'd be grateful for any ideas!

Andrew

On Thu, 18 Nov 2004 20:52:32 +0200, Ira Abramov
<lists-mediawiki-l@ira.abramov.org> wrote:
> Quoting Larry G. Wapnitsky, from the post of Sun, 14 Nov:
> > I cannot seem to locate any documentation on how to properly implement
> > rewrite rules on MediaWiki 1.37. Can anyone point me in the right
> > direction?
>
> here's how I define the virtual server in apache. I do it in the apache
> config since doing it in the .htaccess is cumbersome, puts extra load on
> the server and should generally only be used by people who don't control
> the apache they run under:
>
> # Allow wiki articles to start with a period
> <Files .*>
> Order Deny,Allow
> Allow From All
> </Files>
>
> RewriteEngine on
>
> RewriteRule ^/index.php/(.*)$ http://${SITENAME}.org/$1 [R,L]
> RewriteCond %{REQUEST_URI} !^/(stylesheets|images|config|stats)/
> 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
>
> RewriteRule ^/(.*) /index.php/$1 [L]
>
> --
> Hot Stuff
> Ira Abramov
> http://ira.abramov.org/email/
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>
Re: Re: Rewrite rule [ In reply to ]
On Nov 19, 2004, at 11:15 PM, Andrew Chen wrote:
> I'm trying to do the rewrite right now, but am running into some
> problems.
> For some reason, when I go to:
>
> http://www.myhost.org/index.php/Some_Topic
>
> this format doesn't work! The only way it works for me is with the
> ?title= format. (I don't use a wiki subdirectory to hold everything)

Is PHP running in CGI, FastCGI, or apache2filter (instead of
apache2handler) mode? If so, index.php/Some_Topic won't work and you
must use index.php?title=Some_Topic. The installation script would have
warned you about this with a message like this:

PHP server API is cgi; using ugly URLs (index.php?title=Page_Title)

Some other obscure modes might have similar problems that we don't know
about yet.

Rewrite rules will allow you to make something that looks nicer, but it
must still be rewritten into index.php?title=Some_Topic on the back
end.

-- brion vibber (brion @ pobox.com)