i'm replatforming online shop, , part of process writing 301 redirects old links customers may have bookmarked hit new addresses. of them work apart ones in old address contains %
character. seems somehow interfering regex. rule is:
<rule name="custom 41 redirect" stopprocessing="true"> <match url="^c80/how-to-%20use-shop-name\.aspx" ignorecase="true" /> <action type="redirect" url="/how-to-use-shop-name" redirecttype="permanent" /> </rule>
testing using built in regex tester in iis tells me hitting
/c80/how-to-%20use-shop-name.aspx
matches pattern, yet rule fails redirect me when hit address.
i should stress there 400 rewrites in web.config, 3 contain %
character break.
since string tested against regex url-decoded, no longer need %20
in regex. use plain space:
<match url="^c80/how-to- use-shop-name\.aspx" ignorecase="true" />
also, in case space optional, may use ?
after it:
<match url="^c80/how-to- ?use-shop-name\.aspx" ignorecase="true" />
Comments
Post a Comment