I have 2 separate sites, 1 is a CI membership management system and the other a WP public and members area site. They are hosted on different domains and servers.
Our requirement is to programatically add/edit users on the WP site from CI whilst keeping CI protected from WP. To achieve this we have created a copy of the WP site on the same install as CI but pointed it to the live WP database and blocked all public access to this copy. This way we can use the WP functions locally, allowing CI read/write access to WP and keep the CI system secure, minimising risk of attack via WP.
I have added to the CI index.php: require_once ./wordpress/wp-load.php;
Which works great (after fixing the site_url function), we are now adding and editing users YAY! but…
AJAX requests to some CI functions:- /members/getMemberJSON
are returning 404‘s (which work fine when not loading WP. I think due to the fact that on the WP site /members/%username%
pages already exist.
So the question is how to prevent WP overriding the CI routing. I’m sure this is simple if you know how – Any smart internets help gratefully received.
I think there are a couple of options:
1) You need to rename your controllers or controller methods so as not to conflict with the WP pages.
or
2) You configure your .htaccess to ignore all file name or folder requests and rewrite them as CI compatible queries.
Something on the order of
Note: That’s totally untested, but just an example.