-1

Note: This question is a verbatim copy of the one I posted a week ago there. I've tried various solutions from other questions with no luck, until someone suggested that I ask here on the WP dedicated SO.

After installing a fresh Wordpress 4.8 instance and the latest version of WooCommerce 3.0.8, we are trying to understand how to use the WooCommerce REST API.

From their documentation, it seems to be pretty straightforward, but we just get 404s on each endpoint.

We're new to both Wordpress and WooCommerce, so the different things we read can be misleading and often contradict one another...

  • The Wordpress index endpoint gives us a 404.
  • Any WooCommerce (eg /wp-json/wc/v2/products) gives us a 404.
  • As the Wordpress demo REST site answers, ours serves a 404. Is it even the API base WooCommerce is relying on (confused...)?

The 404s we get are straight from our webserver, not from index.php.

We are trying to understand whether we need some more plugin to enable these REST endpoints. We tried adding numerous without luck.

How to get those REST endpoints enabled? Are we reading an outdated documentation? Is there some Apache/nginx/IIS/LiteSpeed/LiteSpeed trickery involved here (We cannot find any PHP file with those names, so we're wondering if maybe we're missing a rewrite rule)?

1

It was simply a matter of enabling URL rewriting in Wordpress. Basically, go to Settings -> Permalinks and make sure the first rewriting option is set to Posts Name.

-2

Try to edit your wordprees like this, don't miss to add at the end.

<Directory /var/www/wordpress/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

  • downvoted as I do not see the point of an answer which is less complete than the already accepted one, and have no explanation as to the why it should fix anything – Mark Kaplun Mar 5 '18 at 5:06
  • Wordpress automatically handles .htaccess files when you use the integrated Wordpress settings page, so you should avoid changing them manually. – Doodloo Mar 5 '18 at 11:28
  • i have this problem and it's just work with me like this. – Ahmedsaber Mar 8 '18 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.