Names, the "&", and mediawiki (IMPORTANT)

For discussion of and submissions for the EvaGeeks Wiki and Commentary. Open to all posters.

Moderator: Board Staff

Ornette
Administrator
Administrator
User avatar
Age: 43
Posts: 11740
Joined: Dec 26, 2005
Location: Pittsburgh/New York City
Gender: Male
Contact:

Names, the "&", and mediawiki (IMPORTANT)

  •      
  •      
  • Quote

Postby Ornette » Wed Apr 09, 2008 3:04 am

I know some of you have already ran into problems with adding an ampersand in image names or page names (For example: Image:M26' Lilith Wings & Black Moon.jpg). This breaks mediawiki, it doesn't work, don't do it. If you do, you'll have to get someone with direct access to the server to fix this.


The reason for this is because the wiki is set up to use "clean" URLs. That is to say, the URL for an article looks like this:
http://www.evageeks.org/FGP/The_End_of_Evangelion
and not:
http://www.evageeks.org/FGP/index.php?title=The_End_of_Evangelion

Mediawiki handles this by rewriting the URL on the server side. Problem with the rewrite, is everything gets decoded first by the webserver before the rewrite. So a page named: "Rei & Asuka PS2 Raising Game cuteness.jpg" first gets encoded within the page as http://www.evageeks.org/FGP/Rei_%26_Asuka_PS2_Raising_Game_cuteness.jpg then mediawiki does a URL rewrite into http://www.evageeks.org/FGP/index.php?title=Rei_&_Asuka_PS2_Raising_Game_cuteness.jpg, but OH SNAP, "&" is a reserved character in URL's and when mediawiki looks at this, it thinks the page title is "Rei_" and there's is another parameter named _Asuka_PS2_Raising_Game_cuteness.jpg, which is meaningless to mediawiki so it just gets ignored. This makes it so mediawiki stores pages into the database with a "&" in the title but nobody can ever access them. Really lame, yes, and double encoding doesn't help.

Moral of the story, don't use "&"'s in any page names or images or categories or name spaces or anything that appears in a URL. In fact, don't use any reserved character including but not limited to (just to be on the safe side):
%
+
=
?

If you accidentally create a page and you can't link to it, let me know so I can turn off clean URLs and delete it properly.
Paganini's 14th Caprice in Eb Maj - recordings from 2004 -Vinyl collection at Discogs.
I have a haiku,
Okay, Okay, here it is,
damn, I forgot it

Sailor Star Dust
Kept you waiting, huh?
Kept you waiting, huh?
User avatar
Age: 32
Posts: 22606
Joined: Aug 13, 2006
Location: Living in Houston, TX
Gender: Female
Contact:

  •      
  •      
  • Quote

Postby Sailor Star Dust » Wed Apr 09, 2008 12:31 pm

Thanks for the headsup.

And I wonder just whose images that were uploaded you were using as examples... :whistle:

But yeah, I've actually encountered some other weirdness in terms of what you can and can't upload file-name-wise for images...I think it had something to do with spacing or certain symbols like ' but I can't remember off the top of my head. (This was awhile ago.)
~Take care of yourself, I need you~

drinian
Admin Emeritus
Admin Emeritus
User avatar
Posts: 2711
Joined: Apr 03, 2005
Location: In transit
Gender: Male
Contact:

  •      
  •      
  • Quote

Postby drinian » Fri Apr 18, 2008 9:46 pm

Ornette, have a look at this page:

http://www.mediawiki.org/wiki/Manual:Short_URL/Ampersand_solution_with_root_access

There are rewrite rules that will make this work. Note that the first one was specifically used with Dreamhost, although the last one, "Another option," seems more generalized.

Ornette
Administrator
Administrator
User avatar
Age: 43
Posts: 11740
Joined: Dec 26, 2005
Location: Pittsburgh/New York City
Gender: Male
Contact:

  •      
  •      
  • Quote

Postby Ornette » Sat Apr 19, 2008 4:21 pm

drinian wrote:Ornette, have a look at this page:

http://www.mediawiki.org/wiki/Manual:Short_URL/Ampersand_solution_with_root_access

There are rewrite rules that will make this work. Note that the first one was specifically used with Dreamhost, although the last one, "Another option," seems more generalized.

Thanks. I implemented the second and it didn't seem to break anything.
Paganini's 14th Caprice in Eb Maj - recordings from 2004 -Vinyl collection at Discogs.
I have a haiku,
Okay, Okay, here it is,
damn, I forgot it


Return to “The Editorium”

Who is online

Users browsing this forum: No registered users and 0 guests