Link to home
Start Free TrialLog in
Avatar of jazzIIIlove
jazzIIIloveFlag for Sweden

asked on

non www to www redirecting problem in iis - a little urgent

Hi there;

I have a website named as aftonblatte.se implemented in ASP.NET and under IIS 7.5

I need to redirect http://aftonblatte.se to http://www.aftonblatte.se but after adding the rule to configuration file, it simply fails with the following error:


Line 63:             ASP.NET to identify an incoming user.
Line 64:         -->
Line 65:     <authentication mode="Windows" />    
Line 66:     <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
Line 67:   </system.web>

The partial web.config file content is as follows:

<system.webServer>
            <rewrite>
                  <rules>
                        <rule name="Add WWW prefix" >
                              <match url="(.*)" ignoreCase="true" />
                              <conditions>
                                    <add input="{HTTP_HOST}" pattern="^aftonblatte\.se" />
                              </conditions>
                              <action type="Redirect" url="http://www.aftonblatte.se/{R:1}"
                                    redirectType="Permanent" />
                        </rule>
                  </rules>
            </rewrite>
            <defaultDocument>
                  <files>
                        <clear />
                        <!--remove upon opening the site-->
                        <!--<add value="Home.aspx" />-->
                        <!--<add value="Default.aspx" />-->
                        <add value="index.html" />
                  </files>
            </defaultDocument>
            
            <validation validateIntegratedModeConfiguration="false" />        
        <directoryBrowse enabled="false" />
      </system.webServer>

Can you help me?

Regards.
ASKER CERTIFIED SOLUTION
Avatar of crash2000
crash2000
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jazzIIIlove

ASKER

Hi there;

I didn't create the whole website but edited the site bindings and add non-www of it.

Now, it works (You can try).

But one thing is that in your link, it also says creating another website and point it to non-www but i got the confusion of showing the project path. Since it's the same project. Don't you think there will be conflicts?

Regards.
better to do it in your dns settings just point www.domain.com and domain.com to the same address
You can just do it in the dns settings, but search engines prefer a 301 redirect. Which is basically, creating a second site and redirecting it to the first.
It's not a big job. Just create a new site, create a blank page, and then right click, change its properties to redirect it to the other site.