I’m using WordPress 4.9+ which I believe enabled with REST api by default. My permalinks are set to Month and Name
And I’m using Foxhound React theme for my site.
Now my rest api should be available in
http://example.com/wp-json/wp/v2/posts
But its available in
http://example.com/index.php/wp-json/wp/v2/posts
This is why my theme gets 404 error when tries to get data from api.
Now my question is how do I make my REST available without the /index.php
prefix
I’ve manually deployed everything in aws ubuntu micro with a Lamp server. WordPress files are in the root folder (/var/www/html/
)
Also I have tried mod_rewrite module using the following steps
a2enmod rewrite
sudo service apache2 restart
And this is my .htaccess
file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress