Sunday, January 24, 2010

Redirect 301 in IIS7 HTML

It took me a while to figure this one out, but it is really simple.

I moved a file on my site: http://www.luxuryspa.se/massage.html to http://www.luxuryspa.se/spa/massage.html.

Ooops... people had published links to the old adress and suddenly they'd get a 404 - File or directory not found Error. It showed up in Googles Webmaster Tools.

So I googled the problem and there was little advice on how to handle the problem with html-files on IIS. This is how you do it:

  1. Create a file with the name you'd like to redirect from. In my case massage.html and save it in the old location (I just wrote "301 Redirect to http://www.luxuryspa.se/spa/massage.html" in the file so I know what it is)
  2. Start the IIS Manager and go to the directory for your old location. Select the newly created file and right click it. Choose Switch to features view.
  3. Now you can see the file to the left and it is selected. So go ahead and double click HTTP Redirect and fill out the form. For me: http://www.luxuryspa.se/spa/massage.html and status code 301.
That's it!