wordpress wp-json prefix issue

You need to set the permalink structure of your website.

  1. Goto Settings > Permalink.
  2. Remove index.php from the Custom Structure.
  3. Click on Save Changes.

It re-generate your permalink structure. And you’ll be able to access the posts with http://example.com/index.php/wp-json/wp/v2/posts

Updated:

.htaccess code like below:

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

# END WordPress

Note: Change dev.fresh with your own domain.

Leave a Comment