On a site I'm looking after I need to do a 301 redirect on a URL which has a long dash in it, but it is not working. My redirect is in UrlRewriting.config, and is as follows:

<add name='blog1' virtualUrl='^~/news/blog/2011/08/cookies-%E2%80%93-crunch-time-for-website-operators$' destinationUrl='/news/blog/2011/08/crunch-time-for-website-operators' redirect='Application' ignoreCase='true' redirectMode='Permanent' />

As you can see there is a long dash with a hyphen either side.

Any idea why this redirect would not be working?



I managed to get this working by doing the rewrite with ISAPI_Rewrite rather than UrlRewriting.config. And to do so I used the following rule: Note, I didn't have to put the encoded version of the long dash in.

# Helicon ISAPI_Rewrite configuration file
# Version

# basic settings, DO NOT CHANGE THESE
RewriteEngine on

RewriteRule ^/news/blog/2011/08/cookies-–-crunch-time-for-website-operators /news/blog/2011/08/crunch-time-for-website-operators [R=301,L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.