url rewriting - IIS URL rewrite is redirecting instead -


goal

using iis 7.5 , url rewrite 2.0 module, want rewrite relative path "/myapp" "/myapp-public", without browser redirection.

what i've tried

i placed following web.config file in wwwroot:

<?xml version="1.0" encoding="utf-8"?> <configuration>     <system.web>     </system.web>     <system.webserver>         <rewrite>             <rules>                 <rule name="rewrite public" stopprocessing="true">                     <match url="^myapp" />                     <action type="rewrite" url="/myapp-public" />                 </rule>             </rules>         </rewrite>     </system.webserver> </configuration> 

problem

instead of rewriting url on server side, iis responds "301 moved permanently" redirects user "/myapp-public". behaving if had used action of type "redirect" instead of "rewrite".

does know why "rewrite" action perform redirect instead? thoughts on how debug issue further? thanks!

you running courtesy folder redirect iis you, see here: http://support.microsoft.com/kb/298408/en-us. around this, add trailing slash rewrite url, so:

<action type="rewrite" url="/myapp-public/" /> 

but have issue if these in fact actual urls. match url match on rewrite url , cause infinite loop, since ^myapp matches myapp-public. can add end of string ($) match url fix this, i.e. ^myapp$ prevent myapp-public matching on it.


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -