user2605354
user2605354

Reputation: 13

Windows Server 301 redirect

I have a .net site on a shared host environment so I don't have access to other solutions that require access to the server.

If I put the following code in my current web.config, is it enough to do the 301 redirect to my-new-site.com? Thanks.

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

Upvotes: 1

Views: 1181

Answers (1)

Cybermaxs
Cybermaxs

Reputation: 24556

HTTP Redirection is not available on the default installation of IIS 7. You have to add it in Common Http Features for the Web Server Role. Is it enabled on your shared host ?

The correct way to do a permanent 301 redirect is :

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

the default is response status is 302 (Found). More infos here.

Upvotes: 1

Related Questions