asp.net - use iis 8 to remove a section of a URL whilst keeping all other sections -
the input url http://www.mywebsite.com/en-us/lookingtobuy/propertiesforsale.aspx?ppid=md19863
, need url redirst http://www.mywebsite.com/lookingtobuy/propertiesforsale.aspx?ppid=md19863
so need remove en-us/
everything following ?ppid/
variable , rule written need allow match ever input is
this rule should work :
<rule name="remove en-us"> <match url="^/en-us/(.*)" /> <action type="rewrite" url="http://{http_host}/{r:1}" /> </rule>
and if need allow other culture
<rule name="remove culture"> <match url="^/(\w{2}-\w{2})/(.*)" /> <action type="rewrite" url="http://{http_host}/{r:2}" /> </rule>
{r:x}
reference rule pattern. second rule
{r:0}
/en-us/lookingtobuy/propertiesforsale.aspx?ppid=md19863
{r:1}
en-us
{r:2}
lookingtobuy/propertiesforsale.aspx?ppid=md19863
Comments
Post a Comment