Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question
add comment

1 Answer

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

share|improve this answer
    
I'm not realy understand what you mean, could you please make a example rule? –  mc-kay Feb 14 '11 at 17:19
    
redirect blog.(mydomain).com to mydomain.com/blog –  Jacob Feb 14 '11 at 17:21
    
But than its not a subdomain anymore? –  mc-kay Feb 14 '11 at 17:22
    
your users can access it via subdooain –  Jacob Feb 14 '11 at 17:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.