3

I am using the URL Rewrite module for IIS 8.5. It is an ASP.NET website (using Sitecore CMS, though I think this is not relevant here). I want to redirect an old URL such as:

/legacy-pÈge

to a new URL:

/new-page

My rewrite rules look like this:

<rules>
  <rule name="Legacy Redirects" stopProcessing="true">
    <match url=".*" />
      <conditions>
        <add input="{my_rewrite_map:{REQUEST_URI}}" pattern="(.+)" />
      </conditions>
      <action type="Redirect" url="{C:1}" appendQueryString="False" redirectType="Permanent" />
  </rule>
</rules>

<rewriteMaps>
  <rewriteMap name="my_rewrite_map">
    <add key="/legacy-pÈge" value="/new-page" />
  </rewriteMap>
</rewriteMaps>

It does not seem to work, though the rules are evidently 'legal' since the module does not throw an error with this configuration. I have tried URL-encoding the legacy path i.e. /legacy-p%c3%83%cb%86ge but this did not fix the issue.

Matthew Dresser
  • 11,273
  • 11
  • 76
  • 120
  • 1
    I've copied your rules to my `web.config` without any single change and it does redirect `http://localhost/legacy-pÈge` to `http://localhost/new-page`. I'm on Windows Server 2008. – Marek Musielak Jan 19 '16 at 21:49
  • 1
    Have you made any changes to the rule since your first attempt? it's a permanent redirect, so just wondering if you're seeing cached results. I always set the redirectType to "Found" until I'm convinced it's working. – Martin Davies Jan 19 '16 at 21:58
  • Thanks for your help @MarekMusielak. I had my rules in a separate file and was expecting that updating just that file would cause the module to re-load the configuration (like Sitecore does) but it doesn't seem to do that! I only noticed when I pasted my rules directly into the web.config and saved the changes. – Matthew Dresser Jan 19 '16 at 22:27
  • 1
    I had the same issue and had to do an iis reset after each change to my rewriterules.config. – Ian Graham Jan 20 '16 at 08:14

0 Answers0