Menu
Nadzweb.com
Nadzweb.com

Fixing a rewrite issue in WordPress and Zend Framework

Posted on November 8, 2012November 8, 2012 by admin

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.

  • .htaccess
  • wordpress
  • zend framework
  • 1 thought on “Fixing a rewrite issue in WordPress and Zend Framework”

    1. Iso consultancy says:
      March 18, 2013 at 11:41 am

      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.

      Reply

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Anti-spam image

    Tags

    .htaccess angular angular2 angular2-pipes angular4 angularjs apache bigdata blockchain children codeigniter computer graphics ethereum flot flot charts funny hadoop http javascript jquery kanban lena linux love math mathematics microsoft misc node js php phpframework php frameworks postgres pun-intended python react sass scrum scss silverstripe software ssl story valentines day wordpress

    Archives

    Recent Posts

    • Install only Postgres client 11 on Ubuntu 18.04
    • PostgreSQL – Granting access to users
    • Querying JSONB Postgres fields in SQLAlchemy
    • Angular – Writing unit tests for setTimeout in functions
    • Angular 6 – getting previous url from angular router
    ©2021 Nadzweb.com | Powered by WordPress & Superb Themes