views:

64

answers:

3

I have cakephp installed in the root directory. site.com/

i want to install wordpress blog at site.com/blog

but since cakephp will redirect all urls i am not sure how to do it ?

+1  A: 

One way to do this is to have your domain pointing to site.com/cakefolder and then have another subdomain blog.site.com pointing to site.com/blog folder

This way to your user, it would always be site.com and blog.site.com

Nigel
the cakephp files are resting in the root directory..
Harsha M V
then perhaps move them to another directory?
Nigel
+2  A: 

Simply put the wordpress install into a "blog" folder in your /app/webroot folder.

Cake will load from the webroot as if the files were in a normal subfolder under a non-cake appliation. You may need to edit / adjust paths in the wp configs or .htaccess files throughout to get everything perfect but it isn't that difficult.

Abba Bryant
thats not the right way of doing it. thats what some one on irc said. http://dogmatic69.com/blog/development/7-using-other-apps-with-cakephp-htaccess-config
Harsha M V
all that is doing is making a subfolder of any specified name act the same as if you had placed it in the app/webroot folder. I just tested it locally and it works out of the box if you put the wordpress root folder contents in in the app/webroot/blog folder. http://groups.google.com/group/cake-php/browse_thread/thread/a3b4b82eefeb9d8a
Abba Bryant
Before you say it isn't the right way to do it - when it's obvious you haven't even tried it, hence the question being asked here. Why don't you try it. You might be surprises. You *do* need to change the wp paths in various places I believe to get the db file loaded etc.
Abba Bryant
@abba bryant, nobody says it does not work having the folder in webroot. As I even said on my blog you can do that, its the first paragraph. there are just *better* ways of doing things
dogmatic69
Explain please how it's better? I can't see how having your blog at /blog (for example, same path with either method) via either method is superior to the other. Do you consider it better just because of the less cluttered webroot folder? The drawback to your method is that you have to customize parts of your app install that otherwise simply get left alone. Also, I would reccomend simply putting your wp install outside the webroot and symlinking app/webroot/blog to point to the wp install.
Abba Bryant
I understand you say it works my way, and your way (from your post) is better. But nowhere do you explain why/how it is better. All you do in your post is make a different subfolder act the exact same way the webroot already works. Is it just for organizing files? A symlink fixes that issue instantly without editing anything.
Abba Bryant
A: 

From: http://dogmatic69.com/blog/development/7-using-other-apps-with-cakephp-htaccess-config

One thing that is asked quite a lot on #cakephp is how to use other apps alongside CakePHP, and the answer giving is normally pretty ugly. Stick the files/folders in side webroot/. Although that does work, its not very nice. So ill show you a little trick with .htaccess files.

The first (really simple way) is to use a .htaccess inside the sub folder. For example you can have a copy of Joomla! running alongside cake with no issues when you have the .htaccess for Joomla! enabled. If the app does not have one and/or you would not know what to put in the .htaccess file you have another option

Make Apache stop processing rewrites if it finds a request for your sub directory. This is done by adding a rule for the sub directory and then telling Apache it is the last rule to process. The .htaccess file you want to edit is the one found inside your APP directory. All you want to add is the following line:

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteRule (some_folder/.*) $1 [L] # adjust the regex to what you want.

    # normal cake rules
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
 </IfModule>

You can do this for as many sub folders as you wish, by changing the regex accordingly. Its pretty simple to do and a much cleaner way than having all your stuff inside the webroot/ folder of your APP.

Harsha M V