301 Redirect code for IIS

duz

i need the 301 redirect code for IIS.

Thanks
LVL 2
mcse20002000Asked:
Who is Participating?
 
humeniukConnect With a Mentor Commented:
BTW - you can find the official Microsoft info on this here: http://support.microsoft.com/default.aspx?scid=kb;en-us;313074.  The info refers to IIS5, but is applicable to II6 as well.
0
 
humeniukConnect With a Mentor Commented:
It's not code as with Apache/.htaccess.

What you do is go into your website properties via Internet Services Manager.  Under the 'Home Directory' tab, select 'A redirection to a URL' rather than 'A directory located on this computer'.  Then type the desination in the 'Redirect to:' field and make sure you check the 'A permanent redirection for this resource' box (this is what makes it a 301 redirect).

FYI - you can redirect an entire website as above, or a specific folder or even file via 'right-click' -> 'properties'.
0
 
softplusCommented:
For all those still looking for the exact code, just add this to the top of your code:
<%
Response.Clear
Response.Status = "301 moved permanently"
Response.addheader "Location", "http://www.whereveryouwanttosendthepoorguy.com"
Response.End
%>
0
 
humeniukCommented:
To clarify - that is ASP 301 redirect code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.