• I did a vanilla install of WP 5, but REST calls are not working.

    This URL:

    <site_URL>/wp-json/wp/v2/posts/

    Gives me:

    The requested URL /wp-json/wp/v2/posts/ was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    ———–
    Here’s the .htaccess file in the public_HTML directory:

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName <SITE_URL_HERE>

    I tried to contact my hosting company but they told me to contact the developer (which, of course is me, LOL). No help there.

    Thanks in advance,

    M

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>

    That would seem to indicate that the site is entirely blocked, since you’re denying all requests.

    Try removing that .htaccess, or renaming it.

    Thread Starter morkus_wp

    (@morkus_wp)

    Removing .htaccess made no difference.

    The overall site comes up fine in all cases, but not the REST URL.

    The site initially installed as a REST-supported WP 4 site, but automatically updated to WP 5.02.

    Suggestions?

    Thanks much,

    Thread Starter morkus_wp

    (@morkus_wp)

    If I use this URL: (Site_URL)/index.php/wp-json/v2/posts/

    I then get this response:

    {
    “code”: “rest_no_route”,
    “message”: “No route was found matching the URL and request method”,
    “data”: {
    “status”: 404
    }
    }

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Check the permalink settings, make sure it’s not set to the “Plain” setting.

    Thread Starter morkus_wp

    (@morkus_wp)

    I could never find where the permalink settings were.

    In any case, the problem turned out to be that, unlike accessing the site as usual, I needed an explicit “index.php” in the URL path for the REST to return JSON.

    All good now.

    Thanks.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    I could never find where the permalink settings were.

    In the admin, go to “Settings->Permalinks”. In the menus on the left hand side.

    And no, you do not need an explicit index.php in your URL. That might “work”, but what it really means that your permalinks and htaccess are incorrect.

    Thread Starter morkus_wp

    (@morkus_wp)

    My .htaccess is above.

    Thanks for helping me find the Permalinks. ??

    The Permalinks were not set to “plain”. I tried a couple of the other settings, but without the explicit “index.php” in the URL, still doesn’t work.

    Thanks.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Are you running IIS or something? Because again, your htaccess makes no sense, and also is missing the standard WordPress rules.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Simple REST call not working in WP 5.02’ is closed to new replies.