WP 5.2.4


Gives 404 error.

I updated permalinks,have a working .htaccess on Apache and not using "plain permalinks" and still this thing don't work. My Apache and its configuration look fine and everything works except for /wp-json.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

How to fix this frustrating WP bug? Why doesn't Wordpress improve this, when people struggle with this everyday?

My WP routes look like this (trimmed):

array (
  '^wc-auth/v([1]{1})/(.*)?' => 'index.php?wc-auth-version=$matches[1]&wc-auth-route=$matches[2]',
  '^wc-api/v([1-3]{1})/?$' => 'index.php?wc-api-version=$matches[1]&wc-api-route=/',
  '^wc-api/v([1-3]{1})(.*)?' => 'index.php?wc-api-version=$matches[1]&wc-api-route=$matches[2]',
  'sitemap_index\\.xml$' => 'index.php?sitemap=1',
  '([^/]+?)-sitemap([0-9]+)?\\.xml$' => 'index.php?sitemap=$matches[1]&sitemap_n=$matches[2]',
  '([a-z]+)?-?sitemap\\.xsl$' => 'index.php?yoast-sitemap-xsl=$matches[1]',
  'shop-4/?$' => 'index.php?post_type=product',
  'shop-4/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=product&feed=$matches[1]',
  'shop-4/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=product&feed=$matches[1]',
  'shop-4/page/([0-9]{1,})/?$' => 'index.php?post_type=product&paged=$matches[1]',
  '^wp-json/?$' => 'index.php?rest_route=/',
  '^wp-json/(.*)?' => 'index.php?rest_route=/$matches[1]',


As you can see, the wp-json rules should do as it matches an URL like


I have checked which rest routes are available (using the plugin "Rest Manager", nice and clean):


When I hit the URLs:


I get with all of them:

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

They say a list of endpoints is available through GET /wp-json/ but this page also gives 404.

Behaviour is exactly the same for routes I know they are using GET verbs:

404 /wp-json/wp/v2/block-renderer/woocommerce/
  • Some plugins have an option for disable rest api. Make sure all plugins are disabled and try it again.
    – idpokute
    Oct 24, 2019 at 14:27
  • I have not many plugins, basically WooCommerce and WPML. The rest api is "active", the routing is just buggy.
    – Daniel W.
    Oct 24, 2019 at 14:29
  • The reason I suggest all plugins disable is to find whether it is software issue such as plugins or server such as .htaccess issue.
    – idpokute
    Oct 24, 2019 at 14:31
  • @idpokute I found out the Plugin "WPML" is causing this. Any idea how I could further debug?
    – Daniel W.
    Oct 27, 2019 at 15:14

1 Answer 1


First you've to Check if the WordPress REST API is enabled or not

The best way to check is to visit this URL: https://yoursite.com/wp-json. If you see some JSON response, REST API is enabled. If it’s showing some error page or returns to home page, REST API is not enabled. Then we've to enable it first.

In this case, you've to Enable Permalinks

  1. Visit your page's admin page (Visit https://yoursite.com/wp-json)
  2. settings > Permalinks (visit https://yoursite.com/wp-admin/options-permalink.php)
  3. Make sure Plain is not selected
  4. Choose Post Name (it's a best one)
  5. Then click on Save Changes. That will rewrite/repair your .htaccess

More info

  • 2
    Good start, but you haven't mentioned what to do if you see a JSON response (i.e. the API is working). You started with "if enabled or not" but only described the "not" scenario. Will happily turn my downvote into an upvote if you can finish the answer :) Jul 5, 2021 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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