title: Redirecting non www, index.html, 404
body: <p>I have created code to redirect for non www to www, /index.html to "/", 404 to custom page, I am using IIS server and putting this code in web.config file, have a look, its working fine. But I want to know is it good for SEO ? Or It need any modification ?</p>
  
  <p>Thanx</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
      &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;rule name="CanonicalHostNameRule1" stopProcessing="true"&gt;
            &lt;match url="index\.html(?:l)?" /&gt;
            &lt;conditions&gt;
              &lt;add input="{HTTP_HOST}" pattern="example\.com.au$" /&gt;
            &lt;/conditions&gt;
            &lt;action type="Redirect" url="http://www.example.com.au/" /&gt;
          &lt;/rule&gt;
          &lt;rule name="CanonicalHostNameRule2" stopProcessing="true"&gt;
            &lt;match url="(.*)" /&gt;
            &lt;conditions&gt;
              &lt;add input="{HTTP_HOST}" pattern="^example\.com.au$" /&gt;
            &lt;/conditions&gt;
            &lt;action type="Redirect" url="http://www.example.com.au/{R:1}" /&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
      &lt;/rewrite&gt;
      &lt;httpErrors errorMode="Custom" existingResponse="Replace"&gt;
        &lt;remove statusCode="404" /&gt;
        &lt;error statusCode="404" responseMode="ExecuteURL" path="/404error.html" /&gt;
      &lt;/httpErrors&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>