• Just installed a new WP on Centos 9. From the moment I installed WordPress, all calls to wp-json return a 404. The wordpress generated .htaccess file with 660 permissions in in the document root.

    If I run “https://www.billguldenschuhimaging.com/?wp-json/wp/v2/pages”, and while a tab is logged into the site ad the administrator, from my browser at home I get taken to the sample page with the bird flying across it. if, again logged in as the admin, I try to create a new page all wp-json calls fail with a 404 error a sample call pulled from the httpd SSL access log is as follows:

    [16/Jan/2023:15:39:03 -0500] “GET /wp-json/wp/v2/templates/twentytwentytwo//page?context=edit&_locale=user HTTP/1.1” 404 196
    [16/Jan/2023:15:39:03 -0500] “GET /wp-json/wp/v2/users/me?context=edit&_locale=user HTTP/1.1” 404 196

    I am baffled as to how a manually typed wp-json call can work, but one generated by WordPress itself fails.

    Can someone provide any additional things to check?

    Now for reference, I have another site that was deployed a few years ago on Centos 8 and has been kept upgraded to current, and the wp-json works just fine over there.

    Obviously, something is being missed in this new deployment, but I have run out of things I know to check.

    ANY assistance will be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Permalinks isn’t working on you site. That seems to be the root of your problem.

    To confirm this, go to SETTINGS > PERMALINKS and switch your permalink setting to PLAIN. And check wp-json again.

    Standing by for confirmation and next steps.

    Thread Starter gguldens

    (@gguldens)

    Just got some new information.

    https://www.billguldenschuhimaging.com/wp-json/wp/v2/pages will display a json response in my browser.

    https://www.billguldenschuhimaging.com/wp-json/wp/v2/pages returns a 404 error.

    When I try to go to the wp-admin site, https://www.billguldenschuhimaging.com/wp-admin/ I get the login screen for the administrator and can successfully login.

    This would tend to make me believe–since the browser shoes the lock icon locked–that we are talking over https. Additionally, I get all the logging in the httpd/ssl_access_log showing the wp-admin page being served over https.

    This just adds to my confusion as to WHY the https:// version to the wp-json/…/pages url returns json response, but the https:// version returns 404.

    Thread Starter gguldens

    (@gguldens)

    George, I can access the sample page using the URL:

    https://www.billguldenschuhimaging.com/sample-page/

    and the page loads perfectly. That would seem to indicate that the pretty links are working as they should.

    Unfortunately, when I try to access the sample page using https: it fails with a 404.

    It doesn’t seem related to pretty links unless http vs. https also plays into that.

    In that case it’s definitely NOT permalinks related.

    I would check your vhost config. How are you handling HTTP (PORT 80) vs HTTPS (PORT 443)? Anything peculiar there?

    Also, it seems your WordPress is configured to use HTTP. What happens when you switch to use HTTPS?

    Thread Starter gguldens

    (@gguldens)

    switched to https, and still get the same issues.

    I have checked and re-checked my port 80 vs port 443 configurations and cannot find any differences.

    Let me check the httpd/conf.d/ssl.conf file and see if it set differently.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Just installed wordpress all wp-json calls fail with 404’ is closed to new replies.