« Previous Next »

Thread: URL rewrite not redirecting when page names contain +

Last post 06-23-2009 3:42 PM by johnvier. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 06-20-2009, 8:37 PM

    • johnvier
    • Not Ranked
    • Joined on 06-20-2009, 8:29 PM
    • Posts 3

    URL rewrite not redirecting when page names contain +

    Hi,
    I need to redirect old pages that are constructed with the "+" sign, e.g. my+page+name.aspx
    I've enabled the double escape but it seems the URL rewrite does not work with this symbol. I've noted another post reporting the same issue with the symbol :

    Is there any workaround?
    thanks

  • 06-23-2009, 12:06 AM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 636

    Re: URL rewrite not redirecting when page names contain +

    Are you sure that double escape is disabled? I have just tried this configuration with URL Rewrite 1.1 and everything worked as expected:

        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="test" stopProcessing="true">
                        <match url="foo\+bar\.htm" />
                        <action type="Redirect" url="iisstart.htm" />
                    </rule>
                </rules>
            </rewrite>
            <security>
                <requestFiltering allowDoubleEscaping="true" />
            </security>
        </system.webServer>

    http://ruslany.net
  • 06-23-2009, 12:20 PM In reply to

    • johnvier
    • Not Ranked
    • Joined on 06-20-2009, 8:29 PM
    • Posts 3

    Re: URL rewrite not redirecting when page names contain +

     Hi Ruslany,

    thanks very much for your quick reply. Maybe my conditions were wrong, they were inspired from:

    http://blogs.iis.net/carlosag/archive/2008/09/02/iis-7-0-and-url-rewrite-make-your-web-site-seo.aspx

    Here's what I was using:

            <rule name="Redirect Old Files and Broken Links" stopProcessing="true">
              <match url=".*" />
              <conditions>
                <add input="{OldFiles:{REQUEST_URI}}" pattern="(.+)" />
              </conditions>
              <action type="Redirect" url="{C:0}" />
            </rule>
          </rules>
          <rewriteMaps>
            <rewriteMap name="OldFiles">
              <add key="/The+first+page+name+.aspx" value="/folder/47-the-page-name" />
              <add key="/The+second+page+name+.aspx" value="/folder/48-the-page-name" />
            </rewriteMap>
          </rewriteMaps> 

  • 06-23-2009, 3:42 PM In reply to

    • johnvier
    • Not Ranked
    • Joined on 06-20-2009, 8:29 PM
    • Posts 3

    Re: URL rewrite not redirecting when page names contain +

     Hi Ruslany,

    It seems I figured it out, I just used the console interface to enter mapping entries so it actually created the rewritemaps and now redirects properly. That was enough to properly redirect. So the plus sign was not an issue as you said. It is now just a matter of adding the old and new urls. thanks again for your help

    jw

Page 1 of 1 (4 items)