I am planning to post of a series of blogs on how we can use URLRewrite with and without ARR in IIS 7 and above. But before going into URLRewrite we need to understand some basics and there are some prerequisites. So in this blog we will discuss about the prerequisites below.
1) Difference between Rewrite and Redirect
2) Scope of Rewrite with ARR
3) Scope of Rewrite without ARR
4) Regular Expressions
Difference between Rewrite and Redirect:
Also observe that when we use redirect client(IE for instance) knows that the url got changed and you will see a change in url in the client (browser)
Over here client (for instance IE) doesn’t know that resource has changed, so the URL wont change in the client (browser).
Scope of Rewrite with ARR
With Arr URlRewrite can be used to rewrite requests to any site within the same server or any site in any backend server. To achieve this urlrewrite rules have to be created at the server level.
Scope of Rewrite without ARR
• Without ARR URLRewrite can be used to rewrite requests to any other resource within the site. We can’t rewrite requests to a different site or server.
• For this url rewrite rules are created at the site level or at the application level within the site.
A regular expression (regex or regexp for short) is a special text string for describing a search pattern.
- . – 0 or 1 occurrence of any character
Eg: If I specify . It matches 0-9, a-z or any character
- *– specify 0 or more occurrence of previous character
Eg: If I specify s* ; null,s,ss,sss,ssssss,etc matches the pattern
- .* – means it matches null or any word or any series of characters
For eg: .* matches null value,start,match,a.aspx,etc.
- ^– means starts with
For eg: ^s.* matches to start,snap,s, anything that starts with s.
- $– means ends with
For eg: .*s$ matches with s,paas,saas,iaas anything that ends with s.
- + – one or more occurrence of previous character.
Eg: s+ matches with s,ss,sss,etc
1. ?- matches 0 or only one occurrence of the previous character
eg: a? matches a, s? matches s
1. if your text pattern contains any of the above special characters and you want to remove the special meaning of the special characters then you can use a backslash before the special character.
Eg: \. matches . , \? matches ?, \* matches *
You will find a lot of resources in the internet for regular expressions.
I will release my next blog on how to create inbound rules, outbound rules, and rewrite maps shortly.