• 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:

<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.
0
jazzIIIlove
Asked:
jazzIIIlove
  • 2
1 Solution
 
crash2000Commented:
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

http://blog.whitesites.com/How-to-setup-301-Redirects-in-IIS-7-for-good-SEO__634569104292703828_blog.htm

Mark
0
 
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?

Regards.
0
 
David Johnson, CD, MVPOwnerCommented:
better to do it in your dns settings just point www.domain.com and domain.com to the same address
0
 
crash2000Commented:
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.
0

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