title: IIS web.config enable rewrite rules
body: <p>I am trying to remove the extension .php from the url, so that mysite.com/home.php can work as mysite.com/home.</p>
  
  <p>I am hosting my site on 1and1.com and I asked them if the Rewrite engine was turned on, and they said that for the windows server running IIS 7.5 that it is not turned on and that I could turn it on with some code in the web.config file.</p>
  
  <p>I have not been able to find code that turns the rewrite rules on.</p>
  
  <p>Below is the what I tried to use to rewrite urls. But I get an Error 500.19.</p>
  
  <p>Is there really a way to turn rewriting on in the web.config file?</p>
  
  <p><strong>web.config file</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;    
      &lt;system.webServer&gt;
          &lt;directoryBrowse enabled="false" /&gt;
          &lt;defaultDocument&gt;
              &lt;files&gt;
                  &lt;clear /&gt;
               &lt;add value="home.php" /&gt;
               &lt;add value="index.html" /&gt;
              &lt;/files&gt;
          &lt;/defaultDocument&gt;
          &lt;rewrite&gt;
              &lt;rules&gt;
                  &lt;rule name="rewrite php"&gt;
                    &lt;!--Removes the .php extension for all pages.--&gt;
                    &lt;match url="(.*)" /&gt;
                    &lt;conditions logicalGrouping="MatchAll"&gt;
                      &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
                      &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
                      &lt;add input="{REQUEST_FILENAME}" negate="true" pattern="(.*).php" /&gt;
                    &lt;/conditions&gt;
                    &lt;action type="Rewrite" url="{R:1}.php" /&gt;
                  &lt;/rule&gt;
              &lt;/rules&gt;
          &lt;/rewrite&gt;
      &lt;/system.webServer&gt;  
  &lt;/configuration&gt;
  </code></pre>