Today, one of my clients mentioned that his rest api was not working and was returning 404 errors and the iphone app was broken due to the 404 errors.
As he is running wordpress the immediate thought was that wordpress was overriding something and showing 404 errors inside his api directory (usually 404 errors indicate that the folder/file does not exist but we checked and the folder was there).
Here is a visual example of the issue.
When i opened up his .htaccess file in his /api/ directory I could see the following which is pretty standard .htaccess format.
1
2
3
4
56
| Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-dRewriteRule . ./index.php |
I noticed that the rewrite base was not being defined and this usually occurs when you have an apache server configured for “AllowOverride None” so I added another line to his .htaccess file to get it working again (see line 4 below RewriteBase /api/).
1
2
3
4
56
7
| Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteBase /api/
RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . ./index.php |
I hope this helps those who also had this issue.