Topic on Project:Support desk

Quinnj09 (talkcontribs)

I think this issue is the encoding? feel free to educate me...

The URL is showing up as: http://mysite/wiki/Category%3AMyGames

When it should be: http://mysite/wiki/Category:MyGames

How can I fix this?

I am running mediawiki 1.31.0

MarkAHershberger (talkcontribs)

This wiki (mediawiki.org) doesn't have URLS like that, so, yeah, probably something with encoding.

It looks like you are using "pretty" URLs. What webserver are you using and how is it set up?

Quinnj09 (talkcontribs)

Using:

Windows Server 2008

IIS 6.1

LocalSettings.php:

$wgScriptPath = "/wiki";
$wgArticlePath = "/wiki/$1"; # tells MediaWiki how IIS will be rewriting URLs
$wgUsePathInfo = true;

IIS > Rewrite Rule (in web.config):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
                    <match url="^index\.php$" />
                    <conditions>
                        <add input="{REQUEST_METHOD}" pattern="^POST$" />
                        <add input="{QUERY_STRING}" pattern="^title=(<nowiki>[^=&amp;amp;]</nowiki>+)$" />
                    </conditions>
                    <action type="Redirect" url="{C:1}" appendQueryString="false" />
                </rule>
                <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                    <match url="^([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?title={R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
Ciencia Al Poder (talkcontribs)

This is a problem with IIS, which requires colons in URL to be encoded, because of how Windows generally handle colons in paths (C: means C is the drive letter, for example). If you dont't want this, you'll need to use a different webserver like Apache, or even use a Linux server.

Quinnj09 (talkcontribs)

I was about to update my post to note that this problem exists even without ShortURL being used.

So there's no way at all to 'fix' this whilst still using IIS?

Unfortunately changing to a different web server is not an option for us (this decision is outside of my control)

MarkAHershberger (talkcontribs)

Solution that someone else found for the problem: Just above <system.webServer> put:

  ...
  <system.web>
    <!-- Default <,>,*,%,&,:,,? or %u003c,%u003e,%u002a,%u0025,%u0026,%u003a,%u005c,%u003f -->
    <httpRuntime requestPathInvalidCharacters="%u003c,%u003e,%u002a,%u0025,%u0026,%u005c,%u003f" />
  </system.web>
  ...
Quinnj09 (talkcontribs)

Tried this but doesnt seem to be working.

MarkAHershberger (talkcontribs)

did you try restarting IIS? or rebooting? (I'm not at all familiar with IIS, so that is the end of my helpfulness.... sorry.)

Quinnj09 (talkcontribs)

Yeh I did :(

Thats for trying though, I might do some more searching on the internet next week, I think your onto something.

Reply to "URL Decoding issue"