While working on an application for a client, I was faced with below rewrite issue.
The client was using WordPress as the CMS and wanted a restful API service which i had to develop for them.
The requirement was to develop Rest API using Zend Framework.
Once I have written the Rest API, I had some conflicting issues with rewrite rules.
The WordPress application was installed at the web root directory whereas the API service was on a sub-folder /api
So a rest uri with http://www.domain.co.nz/api/account/1234 was giving a 404 WordPress error. I had a look at WordPress .htaccess file but it contained tonnes of rules for W3 Total Cache plugin for WordPress.
I did not want to even touch WordPress .htaccess file so i tried to modify only /api/.htaccess file.
After a bit of tweaking i managed to get the api working. Below are the rewrite rules.
SetEnv APPLICATION_ENV production
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ api/index.php [NC,L]
Hope this helps someone working on Zend and WordPress on same server root.
Simply wish to say your article is as surprising. The clearness on your post is just excellent
and that i can assume you are a professional in
this subject. Fine together with your permission let
me to seize your RSS feed to keep up to date with approaching post.
Thanks 1,000,000 and please keep up the enjoyable work.