Coding and Gaming
Development Blog Categories (1 Articles)
The following is my strategy for Website IIS bindings.

There are basically 4 different addresses that all point to your website. You have an http and an https, as well as a www. and a non-www. version. You should be using https for security and SEO reasons (you can read more about how to setup SSL for free here), and then you will have to pick if you prefer the www. or non-www. version as your main address. I use "https://www." for all my sites, which means that the other 3 addresses should all point to that one. This is accomplished via IIS (Internet Information Services) bindings.

IIS bindings are used to bind a URL address to a website folder that exists on the machine. This is how the machine knows what files to serve to the user when they visit your URL.

Below you will see IIS Site Bindings that enure all traffic to "https://www.redyoshi.com" is served the correct files for the Red Yoshi site.

IIS Site Bindings
"Require Server Name Indication" if you have multiple sites using SSL on your server.

The "Basic Settings" dialog box controls the location of those files.

IIS Site Settings

Now we need to setup another IIS binding for the other 3 addresses and have it redirect to our https version.

Example:
IIS Site Bindings 301

Right click on Sites in IIS and click Add Website...

I will call this one "RedYoshiHttp301", and instead of pointing to the actual files, I will point to any other location. This location will be used to store the configuration.

(I like to create an 301 folder in the website for this.)

IIS Add Website

Now that RedYoshiHttp301 exists we will setup 301 Redirects for it, in order to redirect to the https version.

Click on the "HTTP Redirect" feature in IIS and setup a 301 like this:

IIS HTTP Redirect

Now click on the "URL Rewrite" for this new site and add 3 rules to improve SEO.

The 3 rules keep everything consistent https address, lowercase, and without the trailing / in the URL.

IIS URL Rewrite

That's it, you're done!


Permanent Link
If this article helped you, or you have any thoughts on how to do this better, please click the Like button and/or leave a comment below.

Likes: [0]

Comments: [0]






(this is only to show your gravatar icon)