I have a WP installation in my server that uses WP as an API. I use a few plugins to get my data:
- https://wordpress.org/plugins/acf-to-rest-api/
- https://wordpress.org/plugins/wp-rest-api-frontpage/
- https://wordpress.org/plugins/wp-api-menus/
My theme is a react app that uses the WP rest API to get info.
This was working fine. I installed WP, the plugins and things went smoothly.
I was doing a few things through FTP on friday and accidentally deleted the .htaccess file's contents (not the file itself). While this file was empty, I updated the permalink's structure. I noticed I broke the blog's frontpage (admin works fine) and restored the htaccess and enabled the permalink setting that I thought was enabled before (fresh install, I think it was the "Month and name" setting that was enabled by default).
For some reason, the API urls now return 404 when permalinks are enabled.
If I use the "Plain" setting on permalinks, things almost work (the frontpage plugin is broken, but that's another story I think).
Anyone has an idea of what might've gone wrong or how I fix it? Here's a link to the live site: http://enrique-ramirez.com/dk/ it'll probably have the Plain setting enabled, though.
This is my current .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
UPDATE So if I try to GET this link: /wp-json/wp/v2/posts
it will fail, but if I append index.php
it works (so /index.php/wp-json/wp/v2/posts
. Notice that I'm not using URL params). I read somewhere that I might need to enable mod_rewrite in my apache? But this was working before... so I'm now even more confused.