jcadima
10/23/2015 - 7:36 PM

htaccess for web.config IIS (Windows Server) for Wordpress

htaccess for web.config IIS (Windows Server) for Wordpress

REF: http://codex.wordpress.org/Using_Permalinks#Permalinks_without_mod_rewrite

REF: https://www.customfitonline.com/news/2013/6/20/solve-wordpress-on-windows-server-problems/

IIS 

THIS GOES IN THE WEBROOT OF THE WEBSITE, REPLACES THE HTACCESS FILE

Create filename: web.config
With the following contents
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <directoryBrowse enabled="false"/>
    <defaultDocument>
      <files>
        <clear/>
        <add value="index.php"/>
        <add value="Default.htm"/>
        <add value="Default.asp"/>
        <add value="index.htm"/>
        <add value="Default.aspx"/>
      </files>
    </defaultDocument>
    <rewrite>
      <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
          <match url="*"/>
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
            </conditions>
          <action type="Rewrite" url="index.php"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>


== this is equivalent to htaccess and fixes permission errors when adding new plugins ==

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress