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?

1 Answer 1

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.