locked
IIS & URL-REWRITE RRS feed

  • Question

  • User1164964531 posted

    Apparently I'm missing something...

    I have my web site WWW.BCDCON.COM as well as the standard default web site.

    If I put bcdcon.com in as the URL, I get 403 Access Denied... :(...

    If I put BCDCON.COM as a Host Header in the bindings for the web site, it works,but I want to see WWW.BCDCON.COM as the URL Address

    I watched the video, in stalled URL-REWRITE 1.1, and created a rule for redirect based on the video...but no luck - still get the 430 Access denied...

    In addition, DNS (via nslookup) shows two IP addresses for BCDCON.COM ...yet in looking at DNS there is only one external IP address?

    I'm sure it is something simple, but I'm stumped...

    Thanks..
    Ron

    Monday, June 8, 2009 11:48 AM

Answers

  • User1164964531 posted

     

    Oops... I forgot one thing...the nice little 28 minute video on this topic leaves a couple nagging questions...

    1) If you have multiple sites on your IIS 7.0 - do you make the URL-REWRITE rules on the default web site or on the site you want to have the rule for? --- Experimentation says - the site you want the rule to work for..

    2) You need to have all the host headers for the site you want the rule to work for..for example, when I create a new site I will use bcdblog with a port of 9102.  Once I'm happy with the testing, I edit the "BINDINGS" and add www.bcdblog.com  and port 80 and for the URL REWRITE to work, add "bcdblog.com" and port 80.

    3) Then, since I want the URL REWRITE to work, I add the rule(s) I need to the bcdblog.com site and not the "default" web site....

    One last note - in the video (which was very helpful), the auther uses www_contoso_com and not www.contoso.com - so I had to wonder...does the URL REWRITE use the "_" as a separator or can you use "." -- use the "." and not the "_"! 

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, June 12, 2009 10:27 AM

All replies

  • User-1637866776 posted

    If you want your web site to be accessible via bcdcon.com and then redirect to www.bcdcon.com, then you will need to add two host header bindings for that web site in iis: one for "bcdcon.com" and one for www.bcdcon.com.

    Monday, June 8, 2009 1:16 PM
  • User1164964531 posted

    Sorry, but I have tried that and yet the URL-REWRITE still doesn't work...:)

    Other Ideas?

    Monday, June 8, 2009 3:02 PM
  • User1164964531 posted

    Hmmm...okay I have re-added the binding for bcdcon.com and re-recreated the rule for url-rewrite...but I made a change to the rule from "match all" to "match any" on the conditions - and at least it works internally...but not externally?

    Monday, June 8, 2009 3:28 PM
  • User1164964531 posted

    Have done so..but still no joy...

    Monday, June 8, 2009 4:25 PM
  • User-1637866776 posted

    Can you post the actual rule?

    Monday, June 8, 2009 6:18 PM
  • User1164964531 posted

    <rewrite>
                <rewriteMaps>
                    <rewriteMap name="wwwmap">
                        <add key="bcdcon.com" value="www.bcdcon.com" />
                    </rewriteMap>
                </rewriteMaps>
                <rules>
                    <rule name="add www" patternSyntax="Wildcard" stopProcessing="true">
                        <match url="*" />
                        <conditions logicalGrouping="MatchAny">
                            <add input="{HTTP_HOST}" negate="true" pattern="www.bcdcon.com" />
                        </conditions>
                        <action type="Redirect" url="http://www.bcdcon.com" redirectType="Permanent" />
                    </rule>
                </rules>
            </rewrite>

    Monday, June 8, 2009 6:34 PM
  • User-1637866776 posted

    MatchAny vs MatchAll will not make a difference here because you have only one condition. Other than that the rule looks correct. When I try to browse to http://bcdcon.com, it looks like the DNS lookup fails.

    Monday, June 8, 2009 6:50 PM
  • User1164964531 posted

    Hmm...so the entry in DNS is there for www...

    Question?  why would bcdcon.com work internally then?

    Monday, June 8, 2009 7:00 PM
  • User1164964531 posted

    Once upon a time - back in the NT 3.5x & 4.x, there was a problem with Exchange...if you didn't put the xxx.com in the Network Properties, then Exchange didn't work...seems somewhere along the way, MS fixed the problem (oh but likes so many other things, MS never really documented it...)  Move forward to Server 2008 and you need to leave the DSN Suffix blank and leave the DNS registration on the network connector unchecked....
    If you have to go back and remove these, then you need to go to your DSN Server and make sure there are no DSN entries for the DOMAIN.COM.  For example, I found an "A" record for bcdcon.com ...arrg...so I deleted it and BANG --- now the URL REWRITE WORKS!!! YEA!!!

     How do you know if this is the problem?  When I did an NSLOOKUP for BCDCON.COM on my internal network, I would get two IP addresses back - one external and one internal - hmmm..not right...now I just get the external IP address ---

    Now == how to make this work for IIS 6.0 :)

     

    Friday, June 12, 2009 10:09 AM
  • User1164964531 posted

     

    Oops... I forgot one thing...the nice little 28 minute video on this topic leaves a couple nagging questions...

    1) If you have multiple sites on your IIS 7.0 - do you make the URL-REWRITE rules on the default web site or on the site you want to have the rule for? --- Experimentation says - the site you want the rule to work for..

    2) You need to have all the host headers for the site you want the rule to work for..for example, when I create a new site I will use bcdblog with a port of 9102.  Once I'm happy with the testing, I edit the "BINDINGS" and add www.bcdblog.com  and port 80 and for the URL REWRITE to work, add "bcdblog.com" and port 80.

    3) Then, since I want the URL REWRITE to work, I add the rule(s) I need to the bcdblog.com site and not the "default" web site....

    One last note - in the video (which was very helpful), the auther uses www_contoso_com and not www.contoso.com - so I had to wonder...does the URL REWRITE use the "_" as a separator or can you use "." -- use the "." and not the "_"! 

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, June 12, 2009 10:27 AM
  • User-1637866776 posted

    1) You can have a rule for every site, or you can define a global rule at a server level and it will apply to all IIS sites.

    2) Yes, you will have to explicitly set host header bindings (bcdblog.com and www.bcdblog.com), unless you have a site with "*" host header binding (typically that is "Default Web Site")

    The only reason the "_" was used instead of "." was because the DNS mappings were defined on a local machine in hosts file and IE had some problems with redirection on a local machine if I used "." as a separator.

    Tuesday, June 16, 2009 12:43 AM