简体   繁体   English

IIS URL重写不适用于具有永久链接的外部托管Wordpress

[英]IIS URL Rewrite does not work for externally hosted Wordpress with pretty permalinks

We are hosting our site on IIS 7.0 and Wordpress-based blog with a third-party provider. 我们将网站托管在IIS 7.0和第三方提供商的基于Wordpress的博客上。 We have implemented Reverse Proxy, so folder link from www.mysite.com/blog goes to Wordpress subdomain (which originally has blog.mysite.com URL). 我们已经实现了反向代理,因此来自www.mysite.com/blog的文件夹链接将转到Wordpress子域(其最初具有blog.mysite.com URL)。 The only configuration was made on IIS side Everything works fine if we use standard permalinks in Wordpress - www.mysite.com/blog/?p=7 but I receive 500 error if we switch to "post-name" permalinks - www.mysite.com/blog//%postname%/. 唯一的配置是在IIS端进行的,如果我们在Wordpress中使用标准的永久链接,一切都可以正常工作-www.mysite.com/blog/?p=7,但是如果我们切换到“ post-name”永久链接,则会收到500错误-www.mysite .com / blog //%postname%/。
Most of the questions and solutions I found are about URL rewriting if Wordpress is hosted on the same IIS as the main site but I couldn't find anything related to our situation. 如果Wordpress与主站点位于同一IIS上,我发现的大多数问题和解决方案都与URL重写有关,但是我找不到与我们的情况有关的任何信息。 Do I need alter the Wordpress in some way (eg rules on .htaccess) to cooperate with my IIS rewriting? 我是否需要以某种方式(例如.htaccess上的规则)更改Wordpress以配合IIS重写? I am not that familiar with Apache and PHP... 我对Apache和PHP不太熟悉...
Updated: web.config content 更新:web.config内容

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://blog.mysite.com/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

You need to setup reverse proxy in IIS that requires a combination of URL Rewrite along with ARR. 您需要在IIS中设置反向代理,该反向代理需要URL重写和ARR的组合。 Refer this article for more details: Reverse Proxy with URL Rewrite v2 and Application Request Routing 请参阅本文以获取更多详细信息: 具有URL重写v2和应用程序请求路由的反向代理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM