# How do you implement 301 redirects in IIS 6 using web.config?



## romario11 (Jun 7, 2013)

Hi, 

I've recently redeveloped my website, and as a result some of the URLs have changed. I'm trying to add 301 redirects, so that PageRank from my old pages flow to my new pages.

I've found out from my hosting company that the server my site is hosted on is using IIS 6. I only have access to my server through FTP, so (as far as I know) I can only implement the 301 redirects by uploading a web.config file to the same folder that contains my webpages.

I created a blank web.config file, added the following code and uploaded it to see if it would work:


```
<?xml version="1.0"?>
     <configuration>
      <location path="test.html">
       <system.web>
         <httpRedirect enabled="true" destination="http://www.mysite.com/contact.html" httpResponseStatus="Permanent" />
       </system.web>
      </location>
     </configuration>
```
Unfortunately, this has no effect. Visiting test.html doesn't result in a redirect to contact.html. Test.html just loads as normal and nothing happens.

I'm not sure if it's a coding issue, (as most of the forums seem to suggest the above code) or a configuration issue at the hosting company's end. They've informed me that it's a coding issue and that they don't have to install or configure anything at their end.

I'm new to web.config files, so I'm not sure if they're correct.

Can anyone shed any light on what the problem is, or what I have to do to get this to work? Any help would be greatly appreciated.

Thanks.


----------



## Fjandr (Sep 26, 2012)

Does their tech support not provide any information regarding their configuration? They should be able to tell you how to structure the redirect if it's possible.

That said, I'd get a Linux host that allows shell access, unless you're tied to IIS in some way. There's a number of very good reasons most of the world relies on Linux hosting.


----------



## romario11 (Jun 7, 2013)

Thanks for your reply.

The quality of support I receive isn't the best. They informed me that it's a coding issue and that there's nothing they have to install or configure at their end. They said I should be able to implement the redirects via the web.config file but said coding isn't something they support.

All my web pages are built in HTML, styled in CSS and interspersed with some JavaScript. My contact page links to an ASP file and I was informed by their support team that this wouldn't work on Linux. That's why they advised me to go with a Windows server in the first place.

I guess there's two questions:

1) Can I use the web.config file to implement 301 redirects in IIS 6?
2) If I asked them to migrate me to a Linux server, would my contact form still work?

Thanks for your help.


----------



## Fjandr (Sep 26, 2012)

Unless the host supports the MONO framework, ASP pages won't be interpreted under Linux. Is there a reason your contact page must be written in ASP? There are a ton of PHP contact forms available under Linux.

As for the web.config, I'm not familiar with IIS redirects, so I couldn't say whether or not it would work.

As far as I can tell, you should use the following to implement a permanent redirect using web.config:

```
<rule>
<action type="Redirect" redirectType="Permanent" url="http://www.example.com/{R:1}" />
</rule>
```


----------

