So this is a very common issue. You’re building a site in CakePHP. Client wants a blog. Why code a blog from scratch when you can just use Wordpress? But then you have them play nice together within the same environment.
There are already several articles online about how to accomplish this, but here’s my particular solution.
I wanted Wordpress to live outside the CakePHP environment so it wouldn’t be affected by all the mod_rewrite directives. But I also wanted it to live within the CakePHP structure so I could keep them both under the same SVN branch. This is how to make it happen.
1. In the root folder of your Cake application, create a new ‘modules’ folder. So you should now have three folders in here: app, cake, vendors and modules.
2. Inside the modules folder, create a ‘wordpress’ folder, and install Wordpress there.
3. Back in the root folder on your Cake app, edit the .htaccess file:
RewriteRule ^blog$ modules/wordpress/ [L]
RewriteRule ^blog/(.*) modules/wordpress/$1 [L]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
4. Now go into your /modules/wordpress folder, and create an .htaccess file here:
5. That’s it! Now your Wordpress install will be available at http://www.yourdomain.com/blog, whereas all other Cake functions will work normally.