regex - IIS URLRewrite Regular Expression -
i horrible regular expressions , new url rewrite module in iis please bear me...
i have scenario have 1-2 pages need redirected specific location , protocol (https).
desired url
https://www.domain.com/specific/location/mypage.aspx
i need create sure users hitting specific url when trying access page. of below should redirect user "desired" url:
http://www.domain.com/specific/location/mypage.aspx http://domain.com/specific/location/mypage.aspx https://domain.com/specific/location/mypage.aspx http://www.anotherdomain.com/specific/location/mypage.aspx http://anotherdomain.com.com/specific/location/mypage.aspx https://anotherdomain.com.com/specific/location/mypage.aspx
i need happen page , 1 other page , need create sure these pages beingness redirected ssl, rest of site should redirected http version if user types in https. how can accomplish this, need more 1 rule, etc?
any help appreciated.
thankfully, isn't complicated looks. when creating rules using iis url rewrite module, "url" in match tag looking @ after host name. doesn't see domain.com.
so, in web.config, within system.webserver section, in rewrite section:
<rule name="redirect specific location" enabled="true" stopprocessing="true"> <match url="specific\/location\/mypage\.aspx"/> <action type="redirect" url="https://www.domain.com/specific/location/mypage.aspx"/> </rule>
that way url coming in ends specific/location/mypage.aspx redirected, no matter hostname is.
regex iis redirect url-rewriting
No comments:
Post a Comment