URL Rewriting with IIS (Internet Information Services)

In one of our recent posts, we wrote about the importance of using URL rewriting. In the post we demonstrated URL rewriting using Apache, Linux, and htaccess. While Apache is a very popular and stable web server, it is important to consider using Microsoft’s web server — IIS (Internet Information Services).

To accomplish URL rewriting in IIS, there are a few options.

  • ISAPI Modules.
  • Microsoft URL Rewrite module for IIS 7.
    • The URL Rewrite Module provides a rule-based rewriting mechanism for changing URL requests before they get processed by the web server.
  • ASP.NET Routing.
    • ASP.NET Routing enables you to use URLs that do not have to map to a specific file in a Web site.
  • Content Management Systems.
    • With the release of ektron’s CMS400.net version 7.6, URL Rewriting can be implemented directly through the Content Management System.

Implementing URL Rewriting is definitely worth the work to implement it. Check out some of the previous options for URL Rewriting for IIS.

Website Launch: DiscountSimple.com

129 Web Design & Marketing recently launched the new website for DiscountSimple.com.  A website that works hand-and-hand with many national retailers to bring shoppers to their e-commerce store fronts.

discountsimple.com

The website was created using:

PHP
XHTML
CSS
JavaScript
.htaccess
MySQL
RSS
XML

The website employs URL rewriting and PHP templates.

URL Rewriting with .htaccess and Apache to boost Search Engine Optimization

URL Rewriting has been around for over a decade and can be seen at your favorite blog or a popular e-commerce website. However, in the last few years it has been widely used as it can be a great boon to Search Engine Optimization. Whether you want to “clean up” a URL or you want to boost search engine rankings by injecting keywords into a URL, URL rewriting is a simple process with .htaccess.

URL rewriting example:

URL rewriting is a great way to give a URL more meaning. Let’s say you have a page with a list of items that are for sale and this list is created dynamically via records from a database. When a user clicks on the link of an item they are brought to a page that has more detail about the item (think of the eBay search listings). Many times the URL will look something like this:

http://someurl.com/sale/index.php?item=iPod-shuffle

With URL rewriting you could turn that ugly link into:

http://someurl.com/sale/product/iPod-shuffle/

or

http://someurl.com/sale/product/iPod-shuffle.htm

Why use URL rewriting:

Using one of the latter examples instead of the original will be a boost to your search ranking because a search engine thinks it sees a static link instead of a dynamic link (which can weigh less in search engine algorithms). Moreover, you are taking important information about the page out of the query string and injecting it into the page section or directory section of the URL.

How do you accomplish URL rewriting?

Here’s a quick example on how to accomplish URL rewriting with .htaccess and Apache using the example above:

Example .htaccess file

Options –MultiViews
Options +FollowSymLinks

RewriteEngine on
RewriteBase /sale/
RewriteRule product/(.*)/ index.aspx?item=$1
RewriteRule product /(.*) index.php?item=$1

This above code will turn URL “A” into URL “B”.

URL A: http://someurl.com/sale/index.php?item=iPod-shuffle

URL B: http://someurl.com/sale/product/iPod-shuffle/

Note, that in this example, the .htaccess file needs to be placed in the /sale directory.

Good luck with URL Rewriting.  Please contact us with any questions or comments.

Search Engine Optimization and 301/Permanent Redirects

There are many reasons a web developer or web designer may need to use a redirect.  If you are permanently moving a page, always use a 301 redirect or a permanent redirect. 

What’s the difference between a 301 and a 302 redirect?

A 302 redirect is a “temporary” redirect and is the most commonly used redirect.   When a web developer or web designer uses one of the following methods to accomplish a redirect, a 302 or a temporary redirect is being used.

ASP.net (VB)

                Response.Redirect(“/somepage.html”)

ASP.net (C#)

                Response.Redirect(“/somepage.html”);

ASP

Response.Redirect(“/somepage.html”)

PHP

           Header( “Location: /somepage.html ” );

ColdFusion

                <cflocation url(“/somepage.html “>

HTML

<META  http-equiv=”refresh” content=”0;URL=/somepage.html ” />

JavaScript

                document.location.replace(“/somepage.html”);

These methods will redirect a user from page A to page B, but you are doing a huge disservice to your search engine marketing campaign, because you are basically telling search engines that the page has temporarily moved and it’s no big deal. 

Why use a 301 redirect

Using a 301 redirect tells search engines that the page is permanently being replaced by the page that is being redirected to and to pass along all search engine history.

To accomplish a 301 redirect in one of the aforementioned technologies, use one of the following methods:

ASP.net (VB)

Response.Status = “301 Moved Permanently”
Response.AddHeader(”Location”,”/somepage.html”)

ASP.net (C#)

Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”/somepage.html”);

ASP

Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”,”/somepage.html”

PHP

Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: /somepage.html” );

ColdFusion

<.cfheader statuscode=”301″ statustext=”Moved permanently”>
<.cfheader name=”Location” value=”/somepage.html”>

PERL - CGI Redirect

print $q->redirect(”/somepage.html”);

As you can see there isn’t a corresponding method to accomplish a 301 redirect in HTML and JavaScript, because it currently isn’t possible.  If you would like to accomplish a 301 redirect on pages that only employ HTML/JavaScript, take a look at 301 redirects using .htaccess and/or IIS.  Also note that 301 redirects are not foolproof.  Sometimes, search engines just won’t grab onto the 301 redirect and pass along all of the corresponding information.

Check out all of our articles on search engine optimization and .htaccess

Using the DirectoryIndex property in .htaccess to improve search engine optimization and web site manageability

URL Rewriting with .htaccess and Apache to boost Search Engine Optimization

URL Rewriting with IIS (Internet Information Services)

Search Engine Optimization and 301/Permanent Redirects

 

Daniel G. Lilley Law Offices

We recently performed an SEO campaign and a web site redesign for Daniel G. Lilley Law Offices. Checkout the site.

129 Web Design · PO Box 18207 · Portland, Maine 04112