locked
Bug with special chars in IIS URL rewriter? RRS feed

  • Question

  • User-1457962578 posted

    Hi,

    I use IIS with the URL rewriter add-on and use it for friendly url's.

    There seems to be a problem with special characters inside an url, here is an example:

    http://www.mydomain.com/partofcompanyname_(products_&_technology)

    I already replaced spaces for '_'. I can also change '(', '&' and')' with the corresponding chars such as %28, %26, %29.

    The problem is that the internal url only receives 'partofcompanyname_' as parameter input and not the rest of the string.

    This is my web.config rule:

    <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
        <match url="^([^/]+)/?$" />
        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="index.php?s={R:1}" />
    </rule>

    Any ideas if this problem is to solve with regex? Or is it a problem with the URL rewriter? Because this rule is made with the rule builder.

    Any help is welcome. Thanks!

    UPDATE: The %26 (thus '(') seems not to be the problem. The problem is with the & character which is part of a string not a delimiter for a new parameter. Suggestions are welcome!

    Tuesday, December 24, 2013 9:34 AM

Answers

  • User-1457962578 posted

    Found solution by using UrlEncode, example: url="index.php?s={UrlEncode:{R:1}}".

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, December 24, 2013 1:31 PM