Alternative to Apache’s .htaccess file for IIS?

user80151 picture user80151 · Nov 22, 2009 · Viewed 12k times · Source

I'm moving a WordPress blog from Apache to IIS. It's just for a couple weeks until I get it changed out. But all I can get to is the homepage. Everything else throws errors.

I think my problem is in the .htaccess file:

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

Is there something equivalent to this for IIS?

Thanks.

Answer

Geek Blogger picture Geek Blogger · Feb 10, 2011

I think you would find the answer here - How To Set Pretty Permalinks in Wordpress Runs On IIS 7 I guess you need to put one web.config file in the root folder like :

<?xml version="1.0"?>
<configuration>
 <system.webServer>
 <defaultDocument>
  <files>
    <remove value="index.php" />
    <add value="index.php" />
  </files>
 </defaultDocument>
<rewrite>
 <rules>
     <rule name="Main Rule" stopProcessing="true">
         <match url=".*" />
         <conditions logicalGrouping="MatchAll">
             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
         </conditions>
         <action type="Rewrite" url="index.php/{R:0}" />
     </rule>
 </rules>
</rewrite>
</system.webServer>
</configuration>