[MediaWiki-l] URL Being Sanitized?

Thierry Giroux Veilleux thierry at kronoxt.com
Wed Jan 9 03:51:25 UTC 2013


Just to let you know why it does that.

When you ask for a webpage, you can add attribute to a webpage prior to its
loading which is helpful to send specific data to this webpage.

Let say we want to send the attribute title with the value  "Main_Page" .

Url rewriting, give you the possibility to match one or more of these
attributes with the url structure.

That's why we match  /w/index.php?title=$1 to  /wiki/$1

Note that wiki/$1 is parsed as /w/index.php?title=$1

The thing is, even if we rewrite the url, we can add other attributes to
the url.

You can imagine that : wiki/$1?action=edit is parsed as
 /w/index.php?title=$1&action=edit

As an example :

http://en.wikipedia.org/wiki/Main_Page?action=edit

is the same as

http://en.wikipedia.org/w/index.php?title=Main_Page&action=edit


Therefore, if you send something like /wiki/What's the matter folks?

Apache himself will treat this url as /w/index.php?title=What's the matter
folks&

and /wiki/What's the matter folks?action=edit will be parsed
as  /w/index.php?title=What's the matter folks&action=edit and so on.

the action=edit gives you the edit form of an article with the specified
title.

Now that you understand why it's not working, the only way to put an "?" in
an attribute is to put it in an attribute itself without url rewritting :

/w/index.php?title=What's the matter folks?

As the server waits an & to parse the next attribute it will include the
question mark in the title attribute.

However, if an attribute is part of the URL-rewriting, you can only include
a question mark with the url encoding of it. (%3F)

You will notice that the % alone or without valid letters following it will
not work either. As it is used for url encoding.

Note that when you do a link in the wiki [[What's the matter folks?]] the
parser will parse it as What's the matter folks%3F

http://www.w3schools.com/tags/ref_urlencode.asp


Thierry


More information about the MediaWiki-l mailing list