Archive for tag: IIS

Creating IIS websites from the command line

Recently I was trying to configure a new IIS web server and had to create a large number of new sites.  After creating the first couple via the IIS administrator tool I hit TechNet and found the following article on creating websites from the command line.

In short the following is the syntax to use:

iisweb /createPathSiteName [/bPort] [/iIPAddress] [/dHostHeader] [/dontstart] [/sComputer [/u [Domain\]User/pPassword]]

A more indepth look at 301 redirects

I am always surprised by how much confusion surrounds redirects and how many IT departments say they "cannot be done" due to technical limitations.

There are two basic types or redirect:

  • Permanent - 301
  • Temporary - 302

From an end users point of view both of these redirects will achieve the same result, i.e. the user will enter the URL for page A and will be presented with page B (in both the browser and the address bar).

The big difference between these is how they are interpreted by the search engines.  A 301 redirect indicates that the change is permanent and the search engines will update their indexes accordingly.  This means that the value of the links coming into page A will be attributed to page B.

302 redirects on the other hand tell the search engines that the change is temporary and as such the value of the links is not transferred to page B.

The only other thing to take into account with redirects is whether they are page level (i.e. Page A -> Page B) or domain level (bayshield.com -> www.bayshield.com).

Setting up a 301 redirect in Apache and IIS (the two major web servers) is quite easy and is shown below.

Apache 301 Redirect

One way to setup a 301 redirect in Apache is to create a mod_rewrite redirect rule, which you can add to either the apache config file or .htaccess file.

A simple 301 page redirect rule looks like:

RewriteEngine on

RewriteRule ^page1\.html$ page2.html [R=301,L]

IIS 301 Redirect

To setup a domain level 301 redirect please refer to my previous post.

To setup a page level 301 redirect, open IIS and expand your site in the treeview until you find the file you want to redirect.  Then right click on the file and select properties which will display the screen below.

IIS 301 File Redirect

Select the 'A redirection to a URL' option and then enter the destination URL which can be on the same domain or a different one.  Finally be sure to select the 'A permanent redirection for this resource' checkbox.  Failure to check this box will result in the redirect being created as a 302 redirect rather than a 301.

SEO and the WWW subdomain

One of the bigest SEO problems on the net today is the way in which the www and non-www versions of sites are handled, i.e. http://nfltips.org vs http://www.nfltips.org.

In the examples above, NFLTIPS.org is the domain name, and the www in the second example is actually a subdomain.  From a search engines point of view this means that both URLs are considered to be separate sites, and this is where the issue occurs.

When other web users link to your site (a major SEO ranking factor), they may or may not include the www portion.  This means that some links will be attributed to the www site and others to the non-www site.

Luckily this is fairly easy to fix.  Simply choose which URL you want to be your primary site address and then 301 redirect the other URL to the primary site.

Non-WWW site redirect example in IIS

  1. Setup the www version of the site in IIS as normal
  2. Setup a second site in IIS this time without the www (it doesn't matter what folder you point it at)
  3. On the "Home Directory" table select the third checkbox "A permanent redirection for this resource" and then enter the www url in the "Redirect to" box.

Non-WWW IIS Setup

Now Google and the other search engines will attribute the value of your incoming links to a single domain name and you will receive the maximum SEO benefit.

Configuring IIS to serve video content

I have been asked by a number of people how easy it is to incorporate video into an umbraco powered website.  The most common way of doing this is to host the video on third party sites such as YouTube and then embed the clip on the local site using the javascript provided.

My preferred approach however is to leave the video file on my site and serve it using an open source flash player such as FlowPlayer.  The main benefit of this is that you can then create a video sitemap and submit your clips to google.  This means that when your clip appears in the Google universal search results, it will be sending visitors to your site, not YouTube.

The only catch in serving media files from your own site is that you have to ensure the appropriate MIME types have been added to IIS, or else the video won't be served when the client browser requests it.

How to add .FLV MIME type in IIS

  1. In IIS right click the site and select "Properties"
  2. Under the HTTP Headers tab, select "File Types"
  3. Under the MIME map section click "New Type"
  4. Type ".flv" as the associated extension and "video/x-flv" as the contet type
  5. Finally click "Ok"

Once this is done IIS will happily serve up flash video files with the .flv extension!  i will look at how to create a video sitemap in a future post.