1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

IIS and rewrites

Discussion in 'Site & Server Administration' started by sarahk, Oct 5, 2007.

  1. #1
    I have a client with 2 parts to their website. I do all of one part and act as the middleman for the second part.

    Now, the website I don't run is on IIS with ASP and we've had users mistype the urls for instance they'll enter

    http://mysite.com instead of http://www.mysite.com
    and
    http://www.mytown.mysite.com instead of http://mytown.mysite.com

    This is a 15 minute job to fix on a LAMP system but I accepted a 90 minute quote from the company... anything for peace.

    Well, 3 weeks later they are saying the job is done but...

    In the first example it only works with IE and not with firefox and it's a 302 and not a 301 redirect

    The second instance doesn't work at all.

    I've never heard of a rewrite being browser dependant - the reason given was that different browsers give different server headers. Well, sure they do, but the only header that matters is the requested url!

    Am I being unreasonable - is IIS really such a pig to work with?
    Any pointers I should be giving these guys?
     
    sarahk, Oct 5, 2007 IP
  2. xoise

    xoise Active Member

    Messages:
    665
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    95
    #2
    There's a couple of ways to do this.

    You could grab the host header via ASP, like:
    <%
    strHost = Request.ServerVariables("SERVER_NAME")
    
    ' Redirect if no www
    If InStr(strHost, "www") = 0 Then
         Response.Clear()
         Response.Status = "301 Moved Permanently"
         Response.Redirect("http://www.newsite.com/")
    End If
    %>
    Code (markup):
    That method is by far easier. However, you could look into ISAPI_Rewrite for IIS, which even has a free light version that will turn a .conf file in your root into a file which acts similar to .htaccess in Apache.
     
    xoise, Oct 5, 2007 IP
    sarahk likes this.
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #3
    Thanks - I'll email them that sample.
     
    sarahk, Oct 5, 2007 IP
  4. xoise

    xoise Active Member

    Messages:
    665
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    95
    #4
    No problem.
     
    xoise, Oct 5, 2007 IP
  5. solar44

    solar44 Well-Known Member

    Messages:
    770
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    138
    #5
    have you installed isapi rewrite on the windows server? Lite edition should do, unless you want to use genuine htacces files under windows, than you should consider the pro edition.
     
    solar44, Oct 8, 2007 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #6
    They've got it working but throwing 302 so I've gone back and asked for 301's yet again.

    I don't have access to the server so I can't make changes myself.

     
    sarahk, Oct 9, 2007 IP