Posts Tagged ‘web.config’

301 Redirect on Windows Server

I see a lot of complaints from SEO and Internet Marketing agencies about the hoops they jump through to get Windows Server admins or hosts to create 301 redirects for clients. It is really not difficult at all. I decided to outline the steps so the next time one of you has an issue with a web host you can just copy this info and send it to them or link to it 😉 That might make them feel pretty dumb, but it will get the job done.

IIS6:

Redirect a single file.

  1. Open IIS Manager and locate the website
  2. Right click the file you want to redirect and choose properties
  3. Change the selector to “A Redirection to a URL”
  4. In the “Redirect To:” box type the new URL
  5. Put a check in “A permanent redirection for this resource” (this results in an HTTP status code of: HTTP/1.1 301 Moved Permanently)

That’s it!

Redirect an entire domain name – website.

  1. Open IIS Manager and locate the website
  2. Right click the Website you want to redirect and choose properties
  3. Select the “Home Directory Tab”
  4. Change the selector to “A Redirection to a URL”
  5. In the “Redirect To:” box type the new URL
  6. Put a check in “A permanent redirection for this resource” (this results in an HTTP status code of: HTTP/1.1 301 Moved Permanently)

OPTIONAL: Check “The exact URL entered above” if you want all pages redirected to the home page of the new domain rather than relative pages in the new domain.

IIS 7:

Redirect a single file.

  1. Open IIS Manager and locate the website under sites
  2. Right click the website and choose “switch to content view”
  3. In the right hand pane locate the file you want to redirect
  4. Right click the file and choose “switch to features view”
  5. Important! Verify that it shows the correct file name at the top of the screen
  6. Under the IIS section open “HTTP Redirect”
  7. Put a check in “Redirect requests to this destination” and type in the new URL
  8. Change the status code to “Permanent 301”
  9. Click Apply (this results in an HTTP status code of: HTTP/1.1 301 Moved Permanently)

That’s it!

Redirect an entire domain name – web site.

  1. Open IIS Manager and locate the website under sites
  2. Important! Verify that it shows the correct website name at the top of the screen
  3. Under the IIS section open “HTTP Redirect”
  4. Put a check in “Redirect requests to this destination” and type in the new URL
  5. Change the status code to “Permanent 301”
  6. Click Apply (this results in an HTTP status code of: HTTP/1.1 301 Moved Permanently)

OPTIONAL: Check the “redirect all requests to exact destination (instead of relative to destination)”

New in IIS 7:

For those that understand XML and the web.config file you can add a line similar to the following in the <configuration> section rather than using IIS Manager:

Domain redirect:

<system.webServer>
<httpRedirect enabled=”true” destination=”http://www.my-new-site.com” httpResponseStatus=”Permanent” />
</system.webServer>

File Redirect:

<location path=”my-old-file.htm”>
<system.webServer>
<httpRedirect enabled=”true” destination=”http://www.new-domain.com/my-new-file.htm” exactDestination=”true” httpResponseStatus=”Permanent” />
</system.webServer>
</location>

* copy and pasting the web.config examples could result in the wrong quotes which will cause an error. Re-type your quotes.

—David Blizzard