web.config rewrite rules with wordpress

0

I have been searching for a solution to my need everywhere and the closest solution I found is the following post, which solves only partially: IIS7 URL Redirection from root to sub directory. Let me be more specific: I have developed a site in wordpress on IIS 7.5, I have no previous experience with microsoft servers.

  • I have installed wordpress in a directory named /public_html/00weblive/
  • The site is now ready to be published, and I can navigate it typing the URL http: //example.com/00weblive
  • Wordpress permalinks are "Post name" so that other pages of the site have URLs such as http: //example.com/00weblive/anotherpage/ and http: //example.com/00weblive/anotherpage/supbage/
  • Other relevant Worpress configuration is: "WordPress Address (URL) = http: //example.com/00weblive" and "Site Address (URL) = http: //example.com/00weblive"

Now, I want this site to be visible at URLs where the "00weblive" portion is hidden, and I want to maintain the physical files under /public_html/00weblive/ .

According to the referenced post, I have coded the following as /public_html/web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Root Hit Redirect" stopProcessing="true">
                <match url="^$" />
                <action type="Rewrite" url="/00weblive/index.php" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

This was a good start: typing "http: //example.com" I can see the home page. But from there, any other page still shows as http: //example.com/00weblive/anotherpage/.

I have tried to change wordpress settings, modyfying to "Site Address (URL) = http: //example.com", so that I could eliminate "00weblive" from the permalinks, but that resulted in an IIS error when trying to reach any page (other than home). IIS error is the following:

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Module IIS Web Core

Notification MapRequest Handler Handler StaticFile

Error Code 0x80070002

Requested URL http: //example.com:80/anotherpage/

Physical Path \hmfsw\web\DTCWIN038\XXXXXX.YYYYY.com\public_html\anotherpage\

Logon Method Anonymous

Logon User Anonymous

I tried any possible additional rule, to the extent of my limited knowledge, with no results.

I guess this is more a matter of coding proper rules in web.config, rather than tweaking with wordpress.

This is why I am asking for advises in this community.

Thanks a lot for any suggestion you may give. BR. CP.

wordpress
iis
url-rewriting
web-config
asked on Stack Overflow Oct 9, 2017 by cplini

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0