301 Redirect- How to Canonicalize homepage for windows server/asp?

Discussion in 'C#' started by HighRankingSEO, Dec 9, 2009.

  1. #1
    How do I canonicalize a non www version to the www version of the site...I tried using this:
    http://sitename.com: <%@ Language=VBScript %>
    <%
    Response.Status=”301 Moved Permanently”
    Response.AddHeader “Location”, http://www.sitename.com
    %>
    Code (markup):
    but that did not work. All I got was some asp error. Also, where do I put the code? I put it in the homepages default.aspx file and also tried putting it in the head of the document but neither worked.

    I have never worked with an ASP site before so I am really clueless on this one. Can someone help me out?

    Thank you.
     
    HighRankingSEO, Dec 9, 2009 IP
  2. perfect101

    perfect101 Greenhorn

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    Do you have your own dedicated server? If so install and isapi rewrite (helicontech.com), it can handle Canonicalized urls as well as create SEO friendly URLs.

    Once installed just page the following code into the httpd.ini file
    
    RewriteCond %HTTPS off
    RewriteCond Host: (?!www\.)[^.]+\.[^.]+
    RewriteRule (.*) http\://www.example.com$1 [I,RP] 
    
    Code (markup):
    If you dont have a dedicated server check with your hosting company and see if they support any isapi rewrite filters.

    Hope this helps!
     
    perfect101, Dec 9, 2009 IP
  3. HighRankingSEO

    HighRankingSEO Well-Known Member

    Messages:
    423
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    125
    #3
    that looks like mod rewrite...where do I put the code in a htaccess or what?
     
    HighRankingSEO, Dec 10, 2009 IP