Hey ${desensitizationEmail}, to make sure your account security, please verify your email address here. Verify Email
For your account security, please link your email. Verify Email


What to Do When WordPress Rest API Access Fails with 404 (Access wp-json)?

647 3 mins article
Date Created: Sep. 06, 2022 16:48:59 Last Edited: Sep. 06, 2022 17:16:00

This tutorial aims to teach you how to address the problem when 404 error is reported when accessing /wp-json.

The installed WordPress version is 5.0.2. It is said that the rest API service is enabled by default for version 5 and above, but no matter how to access it, an error 404 is reported, and it needs to be redirected by Nginx.

1. Modify the permalinks
In the permalink settings in the WordPress settings, change the permalink settings to any other than simple, preferably digital.


2. Modify the nginx.conf file Use ps -ef | grep nginx to view the location of nginx and the location of the conf file, and then edit the conf file.


Insert the following sentences in the server to redirect.


3. Restart
the nginx server After modification, first check the availability of the nginx.conf file/usr/sbin/nginx -t.


When you see the above two sentences, it proves to be correct.
Then restart the nginx service/usr/sbin/nginx -s, reload and now use ip+/wp-json again, there will be no 404 error, and the data will come out.

Contact Us