I'm trying to set up a subdomain for my application because I don't want admin code to be mixed into the same folders as regular user code. I'm using CakePHP on a PHPfog server, so I can only use .htaccess to create the subdomain. I have enabled wildcard subdomain support.
Here is my folder structure:
app
app-admin
cake
plugins
vendors
index.php
.htaccess
The 'app' folder is where the "normal user" site code is located. The "app-admin" folder will be for admins, of course.
I'm trying to get a specific rewrite rule that will redirect anything going to the admin.mydomain.com, to the "app-admin" folder. All other subdomains should be ignored (sent to the 'app' folder).
The stock .htaccess file in a CakePHP app looks like this:
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
Right now I'm trying this with no luck:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^admin[NC]
RewriteRule ^$ app-admin/webroot/ [L]
RewriteCond %{HTTP_HOST} ^admin[NC]
RewriteRule (.*) app-admin/webroot/$1 [L]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
Any help to get this functioning would be greatly appreciated.