Wordpress permlink 显示“您现在应该更新您的 web.config。” 在godaddy

sab*_*mar 5 php wordpress custom-wordpress-pages

在 Godaddy wordpress 站点中不显示内页,它只显示主页和 wordpress 管理页面。在“永久链接设置”中单击保存更改时,它会显示“您应该立即更新您的 web.config”。当我在我的站点中添加 web.config 时,它显示 500 错误(主页和管理页面也是)现在该怎么办?修复 500 错误或修复 404 错误以及如何修复?请帮助我。我的 .htaccess 文件在下面

# 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
Run Code Online (Sandbox Code Playgroud)

cha*_*mar 8

你使用的是windows服务器,所以你需要在wordpress根文件夹中的web.config,

如果在根文件夹中找不到 web.config,则添加 web.config 文件并将以下代码添加到其中,

<?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>
        <staticContent>
            <remove fileExtension=".svg" />
            <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
        </staticContent>
        <defaultDocument>
            <files>
                <remove value="index.aspx" />
                <add value="index.php" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

根文件夹是指包含 wp-content、wp-includes 等的文件夹,

如果主页抛出 500 错误,请尝试删除整个<defaultDocument>标记部分

<defaultDocument>
    <files>
       <remove value="index.aspx" />
       <add value="index.php" />
    </files>
</defaultDocument>
Run Code Online (Sandbox Code Playgroud)

  • 尝试删除对我有用的 &lt;defaultDocument&gt; 标签。祝你好运 (5认同)