development, so if I've forgotten something that should be obvious, it
may be because I just didn't know to look for it.
I've been fighting with this for a few days now and I just can't seem
to get it to work correctly. I'm trying to set up multiple cakephp
apps on a 1and1 hosted service. I've tried following the instructions
listed here and elsewhere on how this is done and have gotten pretty
close, but it's just not working right.
The ultimate goal would be to make the various apps available through
<domain>/<appX>, with app1 being a default app if none is provided
(meaning <domain> redirects to <domain>/app1).
My Setup
/
+logs (folder created by 1and1 to track access logs)
+apps
-.htaccess
+cake
+config
+console
...
+app1
-app_controller.php
-index.php
-.htaccess
+config
+controllers
+views
+models
...
+app2
-app_controller.php
-index.php
-.htaccess
+config
+controllers
+views
+models
...
+www
-.htaccess
+app1
-.htaccess
+img
+files
+css
...
+app2
-.htaccess
+img
+files
+css
...
I've modified the /www/appX/index.php file for both apps to reflect
the cake and app directory locations.
Here are the .htaccess files:
/.htaccess:
Options +FollowSymlinks
AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If it's a request for the logs, allow it through
RewriteRule ^logs - [NC,L]
#Otherwise, redirect it to the www directory
RewriteRule ^(.*)$ /www/$1 [L]
</IfModule>
/www/.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Route a general query to the app1 app (This is a default app if none
is specified)
RewriteRule ^$ /www/app1/ [R,L]
</IfModule>
/www/appX/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^$ /www/<appX>/index.php?url= [R,QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /www/<appX>/index.php?url=$1 [R,QSA,L]
</IfModule>
I've noticed a few things.
1) Without the [R] option in the /www/appX/.htaccess file visiting
<domain> redirects me to <domain>/www/<appX> and displays a "missing
controller" error, but if I put the [R] option back in, I get
redirected to <domain>/www/<appX>/index.php?url= and the proper home
page is displayed.
2) Any links created inside the app using an array (example:
array('controller' => 'users', 'action' => 'login')) directs me to
<domain>/<controller>/<action>, instead of <domain>/<appX>/
<controller>/<action> which is what I expected.
I'm sure that I'm just missing some simple configuration setting and
this can all be resolved fairly easily. Thanks in advance for your
assistance.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment