asp.net - Rewrite root url call to subfolder -
i have single page app index.html located in sub folder. people see when acess root url. what's missing in rewrite rule?
<rewrite> <rules> <rule name="spa rewrite"> <match url="http://app.local" /> <action type="rewrite" url="http://app.local/spa/dist" /> </rule> </rules> </rewrite>
your rule should this:
<rule name="spa rewrite" stopprocessing="true"> <match url=".*" /> <conditions logicalgrouping="matchall"> <add input="{http_host}" pattern="app.local" /> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> </conditions> <action type="rewrite" url="/spa/dist" /> </rule>
in answer, used incorrect patter in <match url=
section. , spa not need rewrite files , directories
Comments
Post a Comment