301 Redirect code for IIS

Posted on 2005-05-11
Last Modified: 2010-04-27

i need the 301 redirect code for IIS.

Question by:mcse20002000
    LVL 33

    Assisted Solution

    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'.
    LVL 33

    Accepted Solution

    BTW - you can find the official Microsoft info on this here:;en-us;313074.  The info refers to IIS5, but is applicable to II6 as well.
    LVL 13

    Expert Comment

    For all those still looking for the exact code, just add this to the top of your code:
    Response.Status = "301 moved permanently"
    Response.addheader "Location", ""
    LVL 33

    Expert Comment

    To clarify - that is ASP 301 redirect code.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Read about how to approach blogging and about ways to do it right. Stand out from the crowd and let your knowledge be consumed by a large audience. This article aims to explain how your blog should look like,  the most important things to do while b…
    For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now