我最近将一个Wordpress站点从Apache服务器移动到了Microsoft IIS/7.5服务器,问题是,当移动到IIS服务器时,只有主页起作用。当我转到归档页或单页时,它返回404错误。我认为这是因为IIS不理解<IfModule mod_rewrite.c>
在htaccess中重写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
所以我尝试将上面的htaccess转换为web。cofig如下:
<?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>
但它返回500个错误。有人知道怎么解决吗?