Hi All,

I've used CakePHP for ages and as a framework I really like it and it works nicely. However, it has a nasty snag.

Say you wan't CakePHP to be your main application in the website root (/), and you wanted a Wordpress blog in a subdirectory (/blog/). In order to deal with Cake's routing system, as far as I understand it you have to use .htaccess ignore rules (and specify EVERY directory you want separate), or put wordpress in /app/webroot/, and that works fine.

Is there another way of avoiding this (because it's really too awkward)? Do other frameworks have the same problem? Are there ways round it in other frameworks?

Reason being, I have a potential project to start and I really want to use CakePHP (or at least a framework), and I can't have this awkward snag getting in the way. I just thought I would ask to see if there was a simple answer before I actually started to code anything.

Many thanks :)

Recommended Answers

All 3 Replies

Member Avatar for diafol

I use laravel primarily these days. Have never thought to use Wordpress on top of a framework - but I understand your case. There are a few posts I got on search:

http://grossi.io/2014/working-with-laravel-4-and-wordpress-together/

(Not sure if that's exactly what you're looking for though)

http://davidheward.com/2012/12/laravel-and-wordpress-as-a-subfolder/

(I believe that was with previous versions of software in 2012)

http://forumsarchive.laravel.io/viewtopic.php?id=9918

(some forum discussion about workarounds)

A cms based on Laravel called October - so not Wordpress - seems like a lot of fun, but I haven't tried it yet:

https://octobercms.com/features

Sorry - not CakePHP - but I've never looked at it so can't comment. However, I'm sure somebody, somewhere has tried (and succeeded) to do this.

Member Avatar for iamthwee

I was looking at something similar the other day, except to using codeigniter.

I found the perfect solution was to use cake or CI as the main framework.

But to display the blog for example create a new view and then call the wordpress functions, for example the_header() and the_loop() within the view files.

You would just need to link to all the wordpress main functions.

Okay thanks @diafol, I will look into Laravel and see what I think.

You would just need to link to all the wordpress main functions.

That sounds like a very intensive job!!

When I say wordpress, I mean the webserver I'm planning to do this on already has things working in subfolers. For instance, we have a magento shop and a few other bits and bobs. The website has a homepage and suchlike in static HTML, and I wanted to liven it up abit and make it slightly easier to use. Unfortunately there are a few too many features I would like to create to be using Wp/Drupal etc., so I'm quite happy to do it in PHP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.