Page MenuHomePhabricator

Search field fails when rewrite rules don't pass through parameters
Closed, DeclinedPublic

Description

Author: kigurai

Description:
On my Mediawiki install using the Search form (either "Go" or "Search") fails.
Instead of a search result I get a
"No such special page
You have requested an invalid special page."
If I enter myhost.com/wiki/Special:Search I do get to the search page and can do the search.
Also, if I change the URL from "myhost.com/wiki/Special:Search?search=foo&fulltext=Search" to "/wiki/Special:Search?foo=bar&search=foo&fulltext=Search" then I get results. If the first GET variable is "search" then the URL fails.

This lead me to believe that my Short URL's might be configured wrongly. I use Lighttpd with the following rewrite-rules (picked from the Manual:Short URL page:
url.rewrite-once = (

"(^/wiki/[^:]*[\./].*)" => "$1",
"^/wiki/([^?]*)(?:\?(.*))?" => "/w/index.php?title=$1$2",
"^/wiki/" => "/w/index.php",

)

The wiki is installed to directory "w".


Version: 1.11.x
Severity: critical

Details

Reference
bz12838

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:01 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz12838.
bzimport added a subscriber: Unknown Object (MLST).

Sounds like some problem with your rewrite rules, yes.

It's somewhat undecided whether we want to support this sort of configuration... some would prefer to more aggressively put parameters after $wgArticlePath/$wgActionPaths-style links.

rowan wrote:

I'm not very familiar with Lighttpd, but if I see it right, you make a mistake in your second rewrite rule. You add the query string (the part after the '?' char) to the title, but this will rewrite to (using your example) /w/index.php?title=Special:Searchsearch=foo&fulltext=Search
Clearly, you want to add an ampersand between $1 and $2, but that would also add an unnecessary ampersand if you have an empty query string. I would simply add an extra rule so that you have one for queries WITH query string and one for queries WITHOUT query string.

With Apache's mod_rewrite, I can simply use the qsappend flag to copy the query string over automatically. Doesn't Lighttpd have something similar? In mod_rewrite, this flag will even figure out if it has to use ? or & before the query string.