WordPress on Microsoft-IIS/7.5 Server: Only Home Page works

Question

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?

0
Luu Hoang Bac 3 years 2020-03-31T00:51:15-05:00 0 Answers 98 views 0

Leave an answer

Browse
Browse