Jump to content

Archived

This topic is now archived and is closed to further replies.

lilmer

URL rewrite non www to www

Recommended Posts

Good day, I have to include www on my website and it works using this rewrite rules:

        <rewrite>
            <rules>
                <rule name="Redirect to www" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="domain.com" />
                    </conditions>
                    <action type="Redirect" url="http://www.domain.com/{R:0}" />
                </rule>
            </rules>
        </rewrite>

but the problem is it gives me an error of Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects. Using google chrome.

 

Share this post


Link to post
Share on other sites

Pretty straightforward, the URL you are redirecting to keeps redirecting itself to its URL.

Look into how an URL is made and post again?

Share this post


Link to post
Share on other sites

Try this.

<rewrite>  
      <rules>  
        <rule name="Redirect to WWW" stopprocessing="true">  
          <match url=".*">  
          <conditions>  
            <add input="{HTTP_HOST}" pattern="^domain.com$">  
          </add></conditions>  
          <action type="Redirect" url="http://www.domain.com/{R:0}" redirecttype="Permanent">  
        </action></match></rule>  
      </rules>  
    </rewrite>  

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.