Page MenuHomePhabricator

Support for 404 trick for pretty URLs
Open, LowPublicFeature

Description

Author: me.at.work

Description:
Hey,

I installed TightURL recently, and it's got a very interesting way to handle urls. You can use mod_rewrite, of course, but it claims that is broken and that it's better to use the 404 trick. Here's what you do:

ErrorDocument 404 /index.php

When you go to a url (like http://example.com/List_of_lists), it 404s, and passes that 404 to index.php which then properly displays the article List of lists.

This is a lot easier (especially for new users) than the other techniques listed on [[mw:Manual:Short_URL]].


Version: unspecified
Severity: enhancement

Details

Reference
bz16958

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:27 PM
bzimport set Reference to bz16958.
bzimport added a subscriber: Unknown Object (MLST).

ayg wrote:

I've thought for a while that we should ditch rewrites in favor of a 404 handler. (Or, well, obviously we'd still support rewrites as well.) It would probably allow significantly easier cross-web server setup, if there are no hitches.

Is there really anything we have to do in MW to support this?

Rewrite rules are just one type of configuration, they're the one everyone is used to using.
As long as MediaWiki gets a proper REQUEST_URI I believe that anything that maps your article path to index.php should work.

Just to note, I believe that not everyone can simply setup ErrorDocument. iirc there are some hosts that either make you use a separate config area just to setup error documents, and others that may simply not let you use ErrorDocument in your .htaccess or anywhere else.
Also, for /wiki/Foo style urls, rewrite rules have the advantage of not requiring an additional stat call to the filesystem.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM