After you have developed your CakePHP application. You might need to setup a blog to write about it. As WordPress is probably the most wildly used blog engine, it makes sense to use it to save you some time from writing your own custom blog engine. In this tutorial, we will show you how to setup a WordPress inside your CakePHP application.
It is actually straightforward. All you need to do is to add some conditions to the top .htaccess file.
As shown below, we added two conditions to make sure files under blog will be interpreted as normal PHP files. All requests to blog directory will not be treated as calls to CakePHP application. This way, we can install WordPress under the directory blog. Of cause, you can also use any names you want for the direcotry.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !blog/
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_FILENAME} !blog/
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Hopefully this simple tutorial helped you with your development. If you like our post, please follow us on Twitter and help spread the word. We need your support to continue. If you have questions or find our mistakes in above tutorial, do leave a comment below to let us know.