1

I recently moved a Wordpress site from Apache Server to Microsoft-IIS/7.5 Server, the problem is, when moving to IIS Server, only homepage works. When I go to archive page or single page, it returns 404 error. I think it because IIS doesn't understand the <IfModule mod_rewrite.c> in htaccess rewrite wordpress)

# 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

So I tried to convert the htaccess above to web.cofig like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <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" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

But it returns 500 error. Does anyone know how to solve it?

Luu Hoang Bac
  • 433
  • 6
  • 17

2 Answers2

0

.htaccess file will not work for IIS Server.Instead of .htaccess you need to write web.coonfig file you can get more help here

Tristup
  • 3,603
  • 1
  • 14
  • 26
0

I realized that I have to install the module for IIS for URL rewrite. http://www.iis.net/download/URLRewrite

Luu Hoang Bac
  • 433
  • 6
  • 17