IIS Redirect only for site Index -



IIS Redirect only for site Index -

i'm using iis8 , trying redirect site homepage site based on next conditions:

https://mysite.co.uk http://mysite.co.uk https://mysite.co.uk/ http://mysite.co.uk/

should redirect to: https://site2.co.uk/

whereas resource requests should not redirect, none of below:

https://mysite.co.uk/abc/def http://mysite.co.uk/abc/def https://mysite.co.uk/abc/def http://mysite.co.uk/abc/def

i have tried many variations, nil have tried far has worked, latest:

<rule name="redirect home only" stopprocessing="true"> <match url=".*" /> <conditions> <add input="{request_uri}" pattern="^(.*)" negate="true" /> </conditions> <action type="redirect" url="https://site2.co.uk" appendquerystring="false" redirecttype="permanent" /> </rule>

now i'm pretty sure should trivial, much appreciate putting me out of misery

to redirect index url utilize next condition

<add input="{request_uri}" pattern="^/$" />

for url http://mysite.co.uk/abc/def iis returns next server variables

request_uri = /abc/def path_info = /abc/def

for url http://mysite.co.uk/ next

request_uri = / path_info = /

so alternatively utilize

<add input="{path_info}" pattern="^/$" />

see this more details.

redirect iis rewrite

Comments

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -