需要为子目录中的多个WordPress或将WordPress多站点虚拟子目录重写为根目录的IIS重写规则



我希望所有安装在根网站多个目录中的WordPress重写如下 示例:http://www.example.com/wordpress1/*http://www.example.com/wordpress2/*http://www.example.com/*,其中排除wp-admin目录和所有目录。 管理员 URL 应与原始 :http://www.example.com/wordpress1/wp-admin/相同 我正在使用 IIS10。

或重写带有子目录选项的WordPress多站点规则,例如:http://www.example.com/wordpress1/*http://www.example.com/wordpress2/*http://www.example.com/*将具有相同的豁免。

我将使用插件将类别转换为子域,因此,如果我使用基于子域的WP多站点,则将有3级域名。 例 :http://category.subdomain.domain.com但我希望它是第二级http://category.domain.com.

目前我的网址是http://category.domain.com/subdomain我想删除/subdomain部分。仅此而已。

请尝试此重写规则。该规则将重写 http://www.example.com/wordpress1/*和 http://www.example.com/wordpress2/*以 http://www.example.com/*,并使用wp-admin排除URL。

<rule name="rewrite rule" stopProcessing="true">
<match url="(.*)" />
<conditions trackAllCaptures="true">
<add input="{URL}" pattern="^/[^/]+/(.*)" />
<add input="{URL}" pattern="wp-admin" negate="true" />
</conditions>
<action type="Rewrite" url="{C:1}" />
</rule>

我已经设法通过遵循本教程并添加一个条件函数来使用 $_SERVER 按域名重定向到确切目录。

最新更新