0

I have FTP access to my ASP.NET Websapce (IIS 7) and I route subdomains with a Web.config in the web root folder. She looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="route www and emtpy requests" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^(www.)?example.com" />
                        <add input="{PATH_INFO}" pattern="^/www/" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="\www\{R:0}" />
                </rule>
                <rule name="route to blog" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^blog.example.com$" />
                        <add input="{PATH_INFO}" pattern="^/blog/" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="\blog\{R:0}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

As you can see i have two folders in my root directory: "www" and "blog". When i now enter "blog.example.com" everythink is working fine, but when i click a link i will go to "blog.example.com/blog"

What can I do to prevent this behavior ?

NKnusperer
  • 111
  • 1
  • 4

1 Answers1

1

Its because your redirecting to blog.foo.com/blog, you need to redirect to the FQDN.(foo.con/blog instead.

Jacob
  • 9,114
  • 4
  • 44
  • 56