• Resolved telesites

    (@telesites)


    Hello,

    I tried to look around to see if anyone else is having this issue but only found one other who having a similar problem with .htaccess – that did not apply to us as we are on a windows server with PhP. Of course windows doesn’t use .htaccess.

    The issue:
    Bug in Permalink – “REST API encountered an unexpected result”

    New install of WordPress 5.3.2 on a Windows Server running PhP. New database – new folder – new install. No plugins installed. If we change the Settings | permalink to anything other than default and we get error when we try to save any page or post:

    “Updating failed. Error message: The response is not a valid JSON response.”

    Looking in the Tools | Site Health Status we find.
    “REST API encountered an unexpected result”

    Changing permalink back to default this problem goes away and we can edit again.

    It appears the change of permalink is trying to edit the web.config file as it warns that we need to change the permissions so it cannot be written to – however we do not see any change in the file. Is there a bit of code that is supposed to be added?

    Changing permalink back to the default setting allows us to edit and save again.

    Thanks for any help shedding some light on this.

    • This topic was modified 4 years, 11 months ago by telesites.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    web.config needs a specific rule set for “pretty permalinks” to work. WP should be able to write these when you update permalink settings, provided its user has write permissions set. You can later revoke permissions for security purposes if you wish.

    While it’s a little old, I think this example is still valid if you’d rather manually enter the rule set (I don’t have a current IIS site I can reference to confirm):
    https://gist.github.com/Toddses/7f3729ddf7c6466bb3dc

    Thread Starter telesites

    (@telesites)

    Thanks bcworkz,

    Yes that is indeed what we used to fix our issue.
    I found that exact page just after posting this – I forgot to jump back in here and post the fix, so thanks.

    That said, we have over 50 sites running just fine on IIS with no problem with any permalink settings. This only happened with the latest updated WP site.

    Comparing our old web.config with this new suggested web.config we only found this little section was missing:

    <outboundRules>
    <clear />
    </outboundRules>

    Also the <clear /> entered after <files> and <rules> as well.

    All is well as it is now working.
    Hope this helps someone who runs across the same issue.

    Moderator bcworkz

    (@bcworkz)

    Cool! Thanks for reporting back with your findings. There are good odds it’ll help someone else in the future.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘REST API encountered an unexpected result’ is closed to new replies.