Scott Forsyth's Blog

Postings on IIS, ASP.NET, SQL Server, Webfarms and general system admin.

.

  • Scott Forsyth

Hosting Needs

Training and Dev Labs

URL Parts available to URL Rewrite Rules

URL Rewrite is a powerful URL rewriting tool available for IIS7 and newer.  Your rewriting options are almost unlimited, giving you the ability to optimize URLs for search engine optimization (SEO), support multiple domain names on a single site, hiding complex paths and much more.

URL Rewrite allows you to use any Server Variable as conditions, and with URL Rewrite 2.0, you can also update them on the fly.  To see all variables available to your site, see this post.

An understanding of the parts of a complete URL are essential to working with URL Rewrite, so I’ll include the basics here.  Ruslan Yakushev’s configuration reference was my authoritative source for this.

Take this URL for example:

image

The URL is http://www.bing.com/search?q=IIS+url+rewrite

The parts of the URL are: http(s)://<host>:<port>/<path>?<querystring>

Part Example Server Variable
http(s) http SERVER_PORT_SECURE or HTTPS = on/off
<host> www.bing.com HTTP_HOST
<port> Default is 80 SERVER_PORT
<path> search The rule pattern in URL Rewrite
<path> /search PATH_INFO
<querystring> q=IIS+url+rewrite QUERY_STRING
entire URL path with querystring /search?q=IIS+url+rewrite REQUEST_URI

It’s important to note that /, : and ? aren’t included in some of the server variables. Understanding which slashes are included is important to creating successful rules.

Comments

Twitter Trackbacks for URL Parts available to URL Rewrite Rules - Scott Forsyth's Blog [asp.net] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 URL Parts available to URL Rewrite Rules - Scott Forsyth's Blog         [asp.net]        on Topsy.com

# April 20, 2010 10:30 AM

URL Parts available to URL Rewrite Rules | 007Nova Articles said:

Pingback from  URL Parts available to URL Rewrite Rules | 007Nova Articles

# April 22, 2010 1:56 PM

Where can I get a good screen protector for my iPad? said:

Pingback from  Where can I get a good screen protector for my iPad?

# April 24, 2010 10:34 AM

Now Enhance Your Driving Experience With the All New Ford Mustang … | Shaker Scoop Coachwork Design said:

Pingback from  Now Enhance Your Driving Experience With the All New Ford Mustang &#8230; | Shaker Scoop Coachwork Design

# May 6, 2010 8:02 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)