• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1087
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Worried about phishing attacks?

90% of attacks start with a phish. It’s critical that IT admins and MSSPs have the right security in place to protect their end users from these phishing attacks. Check out our latest feature brief for tips and tricks to keep your employees off a hackers line!

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