Iis – Configure URL redirection in IIS 7

iisredirect

I am brand new to IIS, so I apologize if this is a simple request.

I have an application set up at http://servername/longlocationhere. The application unfortunately uses hardcoded links in its code, so I can't change the name of the application or its server location. I would therefore like to simply set up a redirect from http://servername/shorturl to the actual URL. It doesn't need to mask the URL or anything, I'd just like to have a shorter URL redirect to the longer one. How can I accomplish this? All of my searching hinges on redirecting an entire site, which is not what I'm going for.

Best Answer

Technet has a section of Configuring HTTP Redirection in IIS 7. Including situations like:

  • You have changed the name of a virtual directory and you want users to be able to access files from the old URL.

Which seems like something exactly like you are looking to do.

Obviously, first create the directory for the shorturl and set the redirect properties on the shorturl folder level. If you are looking redirect to a relative destination:

  1. Open IIS Manager and navigate to the level you want to manage.

  2. In Features View, double-click HTTP Redirect.

  3. On the HTTP Redirect page, select Redirect requests to this destination. In the corresponding box, type the file name, directory path, or URL to which you want to redirect the user.
  4. In the Actions pane, click Apply.

If you are looking to redirect to a exact/full path destination:

  1. Open IIS Manager and navigate to the level you want to manage.

  2. In Features View, double-click HTTP Redirect.

  3. On the HTTP Redirect page, under Redirect Behavior, select Redirect all requests to exact destination (instead of relative to destination).

  4. In the Actions pane, click Apply.