Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

Misunderstanding rule pattern groups

$
0
0

Trying to implement a simple http->https redirect described at http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/ 

 

<rule name="Redirect to HTTPS" stopProcessing="true"><match url="(.*)" /><conditions><add input="{HTTPS}" pattern="^OFF$" /></conditions><action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" /></rule>

I don't quite understand the usage of {R:1} which should be a regex group 2 from "(.*)" pattern.

If in IIS I open the rule test dialog thenfor the url to test http://my.site.com/default.aspx?action=welcome it parses it into 2 groups:

R:0   http://my.site.com/default.aspx?action=welcome
R:1  http://my.site.com/default.aspx?action=welcome

So I assume that url="https://{HTTP_HOST}/{R:1}"  should be translated into https://my.site.com/http://my.site.com/default.aspx?action=welcome ?

But the rewite redirect above does redirect to https://my.site.com/default.aspx?action=welcome correctly.

Could you clarify please where I am wrong?

 


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>