Redirects on Windows Servers (IIS)

September 24th, 2008 by Carl | Filed under Basic SEO, IIS, SEO tips, URLs.

Permanent Redirects (301) or Temporary Redirects (302)

On Windows servers, the process is not so straight forward as with Apache and mod_rewrite but works by creating an extra web site, but you can rewrite the with a non-www URL to the www version.

To access the server control panel, go to:

Start > Programs > Administrative Tools > Internet Services Manager

If you have many websites they will appear, under the server tree. Right-click on the website that you want the redirect to go from and select properties and then the ‘Home Directory’ tab. The web site properties control panel will appear.

IIS Control Panel
IIS control panel file

The default option is the ‘A directory below this one’. Un-check this and click ‘A permanent redirection for this resource’. In the ‘Redirect to’ text box enter the domain name of the site you wish to redirect to.  By selecting “permanent redirect” your are specifying a 301 re-direct, otherwise it will be a 302 redirect.

Redirecting Individual Pages

Once again, to access the server control panel, go to:

Start > Programs > Administrative Tools > Internet Services Manager

and right-click the web site that you wish to change. Select properties. The file tab will appear. By default the ‘The designated file’ radio button will be selected. Change this to  ‘A redirection to a URL’ then enter the new page URL in the ‘Redirect to’ text box. As before, selecting ‘permanent redirection’ will create a 301 redirect. Unchecked will create a 302 redirect.

IIS control panel file

Redirecting Dynamic Pages by Passing Parameters

Many websites use variables to generate the pages. You can redirect these URLs by adding codes at the end of the domain.

Code Meaning Description
$P Redirect the old url to the new URL passing parameters from ? not including question mark. e.g. $P = ‘id=product1034′
$Q Redirect the old url to the new URL passing parameters from ? including question mark. e.g. $Q = ‘?id=product1034′
$S Passes the matching suffix of the URL to the new URL e.g for http://www.oldsite.com/shopping/cart.asp, $S=’/cart.asp’. but for http://www.oldsite.com/shopping $S=’/shopping’
$V Removes the server name from the original request. http://www.oldsite.com/shopping/cart.asp $=’/shopping/cart.asp’
* Wildcard redirect all requests for html pages to a single asp page – you could do so in the following way: *;*.htm;page.asp

The usage of the command is as follows:

http://www.newdomain.com$V$Q

This will take the server name from the URL of the old domain and leaving the query string and append it to the new URL with question mark attached. Note there is not trailing slash at the end of the URL.

Canonical Form Redirects

To redirect all URLs which are not in canonical form, ie. there don’t contain www before the domain name. A second server can be set up on IIS with the following code which redirects all non-canonical URL to canonical form URLs.

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, http://www.example.com
%>

To pass query strings and parameters change the code to:

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, http://www.example.com$V$Q
%>
Extra Products or Services That May Help
Interested in getting Fireworks online ?
Manager Training here
Polish Translation here
Filming Location available here
try out the remote golf cart
Bookmark and Share

Tags: ,

Share Your Thoughts

// //]]>