On Mar 8, 2011, at 16:03, lauraw wrote: > What I'd really like to do is have my wordpress area still within the > cake environment and so under the cake webroot area.I'd kind of like > the two to live together. The reason for trying this is to make use of > all of the WP and other plug-in functionality I'm using (users, > logging in/out, registrations, payment, etc) - making the WP index the > home page for the site. From the WP index I would have links to cake > functionality, available to a member after logging in. > > So, it would go like this: > > user -------> http://mydomain ------> cake/app/webroot/something > (this is the WP install) > user logs in > user chooses cake controller/action ------> http://mydomain/controller/action > ------> cake does it's stuff > > I've tried setting the document root to webroot/something and it does > take me to the WP index when I go to http://mydomain. But I can't > figure out how to access the cake stuff (just getting 'bad request') > from there. > > Is there a way to keep the document root as cake/app/webroot, and > still within the context of cake, but somehow get cake to go to > (route?) webroot/something/index.php? > > I'm open to creating 2 subdirectories (one for the wordpress piece and > another for the cake stuff) or even using a subdomain. Is that the > best way to go with this kind of situation?
The first thing to make sure you understand is that the organization of your web site URLs doesn't need to have anything to do with the way files and directories are laid out on your server's hard disk. WordPress and CakePHP both have prescribed directory layouts on disk, and you shouldn't stray from them too much. They are also independent systems and shouldn't be mixed on disk. Have a directory for your CakePHP app, and a completely separate directory for your WordPress blog. Now you can turn your attention to your web server configuration, where you can define under what URLs these two systems will be available. If you want these two separate systems available via two separate hostnames, that's easy enough. You'll set up two virtual hosts. One will have its document root pointing at the right place in your CakePHP project (app/webroot), the other will have its document root pointing at the right place in your WordPress installation (wherever that is; I don't know how WordPress is set up). If you want them both on the same hostname, then you have to decide how the URLs will mingle. Your DocumentRoot will point to one of the two systems, and you'll set up Alias or maybe Rewrite rules for the URLs of the other system. I know CakePHP comes with Rewrite rules that you're supposed to use; perhaps WordPress does too. You'll have to adapt one or both systems' rules to be able to coexist with one another in the way you want. The one you choose to use as the DocumentRoot should be the one that is the "main" system that will be used. For example, if you have a big CakePHP web site with lots of controllers and routes, and then just the homepage will be the WordPress blog, consider pointing the DocumentRoot at the CakePHP app. You also mentioned wanting to use the WordPress user authentication system. If you mean that you want a user to be able to log in to your CakePHP web site using their credentials from your WordPress installation, then that's a totally separate topic to research. I see two options for this case: 1) the user gets a separate login page for your CakePHP app, but can provide the same username and password as your WordPress installation uses (you'd have to write your CakePHP authentication code to access the WordPress user database table, and understand how they store passwords); 2) the user only has to log in once, to the WordPress app, and the CakePHP site "knows" this automatically (you'd have to find out how WordPress stores user authentication on the client (cookie?) and figure out how to read it). Good luck. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
