简体   繁体   中英

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. We have implemented Reverse Proxy, so folder link from www.mysite.com/blog goes to Wordpress subdomain (which originally has 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%/.
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. Do I need alter the Wordpress in some way (eg rules on .htaccess) to cooperate with my IIS rewriting? I am not that familiar with Apache and PHP...
Updated: web.config content

<?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. Refer this article for more details: Reverse Proxy with URL Rewrite v2 and Application Request Routing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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