I have CakePHP 2.4 installed in my webroot, and wordpress installed in: vendors/php/wordpress.

I am now trying to perform a ModRewrite such that requests to /blog will be rewritten to the folder vendors/php/wordpress.

My .htaccess in the project root is as follows:

<IfModule mod_rewrite.c>
 RewriteEngine on
 # Redirect all /blog/ requests to the wordpress folder:
 RewriteRule ^/blog$ vendors/php/wordpress/ [L]
 RewriteRule ^/blog/(.*)?$ vendors/php/wordpress/$1 [L]
 # default CakePHP routing:
 RewriteRule    ^$ app/webroot/    [L]
 RewriteRule    (.*) app/webroot/$1 [L]   

However, when I try to access: http://localhost/blog - I get the standard CakePHP error message that the BlogsController is missing (and hence, rewrite is not working).

I have also tried debugging mod_rewrite in the log files, and it seems my patterns are not matching ^/blog$ and ^/blog/(.*)?$, however I cannot figure out why.

What am I doing wrong?

Read more here: CakePHP rewriting to WordPress in Subfolder


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: