Wordrpress wp-json not found on server -- localhost

Viewed 5697

Here's the sitch:

I downloaded and installed Wampserver64 and Wordpress 5.2.3

I finally made it to my site, but I can't preview or publish pages with the new Gutenberg or block editor because something is broken! When I edit with the Classic Editor, it's all good.

****Here's not the notice I get from the Site Health Plugin****

The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages. The REST API call gave the following unexpected result: (404) Not Found The requested URL /wordpress/wp-json/wp/v2/types/post was not found on this server. Apache/2.4.39 (Win64) PHP/7.3.5 Server at sitefolder Port 80

I have scoured the internet on how to fix this but so far nada. Help much appreciated!

2 Answers

You have to add index.php after your folder name in the URL in order to make WordPress API work on the localhost. For example: localhost/trial-wordpress/index.php/wp-json/wp/v2/posts

It worked for me.

If you're still working on it try the suggestions from this post: Wordpress REST API (wp-api) 404 Error Even if it's quite old there are some ideas you could try, like switching your permalink structure to sth. other than plain, check mod_rewrite under apache and so on. Classic Editor is not using the REST API, therefore no error.

Related