IIS 7, 8 Redirects – Use URL Rewrite to redirect to another URL one domain or name to another

For example, say you want to create a word in your network, when typed into a browser it would then redirect to a another URL or  site not on the default port 80.

 

For me I am redirecting spiceworks to my Spiceworks portal, which happens to be at spiceworks.domain.com:9675/portal

So when I type in spiceworks, it redirects to http://spiceworks.domain.com:9675/portal

I am going to break this down into 2 main steps.  DNS and Web Server with URL Rewrite.

Step A1: On your DNS Server (Internal or External if using another domain name) add a new host and point it to your Web server.

New Host DNS

 

 

 

 

 

 

 

 

 

 

Step B1:

Install URL Rewrite into your IIS environment.  Easy, just go to this website on your web server and click install this extension.

http://www.iis.net/downloads/microsoft/url-rewrite

Step B2: Close and re-open IIS, you should now see the URL Rewrite extension under the IIS section.

URL Rewrite Extension

 

 

 

 

 

Step B3:

Open URL Rewrite, and on the right hand column select ‘Add Rule(s)’

Step B4: Select ‘Blank rule’

Step B5:

Match URL

– Name: Enter a name

– Using: Regular Expressions

– Pattern: (.*)

Conditions Add

– Input: {HTTP_HOST}

– Type: Matches the Pattern

– Pattern: ^spiceworks$ (ignore case)

Action

– Action Type: Redirect

– Redirect URL: http://spiceworks.domain.com:9675/portal

Click Apply on the Right Hand Column

Forward Rule URL Rewrite

 

 

 

 

 

 

 

 

 

If you want to just import a script here’s the script:

Script

 

 

 

 

Copy and Paste:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^spiceworks$
RewriteRule (.*) http://spiceworks.domain.com:9675/portal/$1

Then save the file as someName.htaccess and use the Import function inside the URL Rewrite extension.

 

More information on URL Rewrite Rules.

http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference

http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/

Advertisements
Categories: Uncategorized | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: