Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up CakePHP in a subdirectory; Wordpress is installed in the root

I have been searching for a solution for 2 hours but nothing seems to work... here is my problem:

I have WordPress installed in the root (var/www). So by going to http://www.geekderek.com, I see my wordpress site.

I put CakePHP in a subdirectory var/www/cakephp. I want to be able to see my CakePHP app by going to: www.geekderek.com/cakephp.

However, currently this url just returns a Wordpress page saying "Content not found."

I believe this problem can be solved by modifying .htaccess in my root directory. So here is my .htaccess: http://pastebin.com/sXJTRstB

As you can see, I added this line to the default WP .htaccess file:

RewriteRule    ^cakephp(/(.*))?$ cakephp/app/webroot/$1    [QSA,L]

However, for some reason this doesn't seem to work.

Could anyone please tell me what is wrong?? Thank you so much!

like image 209
Derek Chiang Avatar asked Dec 07 '25 02:12

Derek Chiang


1 Answers

I have simmilar setup, that my cake app is in subdirectory, my root .htaccess has this rewrite rule:

RewriteRule ^cakephp/(.*)$ /cakephp/$1 [L,QSA]

All the rest is handled with the regular cakephp setup.

my /cakephp/app/webroot/.htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

hope this works for you too :)

like image 173
thanat Avatar answered Dec 08 '25 22:12

thanat