Jump to content

URL rewrite non www to www


lilmer

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.

 

Link to comment
https://forums.phpfreaks.com/topic/278060-url-rewrite-non-www-to-www/
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>  

Archived

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

×
×
  • 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.