• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1083
  • Last Modified:

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:

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

Can you help me?

  • 2
1 Solution
I would use a 301 Redirect as it will be better for search engine optimization.
Here is a link that explains it in detail

Let me know if you have probelms


jazzIIIloveAuthor Commented:
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?

David Johnson, CD, MVPOwnerCommented:
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.

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now