asp.net - URL rewriting with space & "+" symbol in web.config -


i want redirect old url "http://staging.tempsite.com/about-us/institute-+target/%20"

to new url ""http://staging.tempsite.com/about-us/news-events""

<rule name="rule59" stopprocessing="true"> <match url="(.*)" /> <conditions logicalgrouping="matchany" trackallcaptures="false">   <add input="{http_host}{request_uri}" pattern="staging.tempsite.com/about-us/institute-\+target/\s*" /> </conditions> <action type="redirect" url="./about-us/news-events" /> 

i tried followoing patterns.

pattern="staging.tempsite.com/about-us/institute-\+target/\s*$"  pattern="staging.tempsite.com/about-us/institute-\+target/ $" 

@wiktor stribiżew comment correct, not work. if have + in url, need enable allowdoubleescaping in config. example of config:

 <system.webserver>     <security>         <requestfiltering allowdoubleescaping="true"/>     </security>     <rewrite>        <rules>             <rule name="rule59" stopprocessing="true">                 <match url="^about-us/institute\-\+target/\s*$" />                 <action type="redirect" url="/about-us/news-events" />             </rule>         </rules>     </rewrite> </system.webserver> 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -