Routing with Multiple Subdomains
Ever want to have multiple admin routes and use subdomains?
After wanting to integrate 3 different parts of an application I wrote into one app, I looked and found some great pieces of information in the bakery on having more then one admin route and using admin routes on sub domains. So after playing and wanting an easier way to define everything.
Resources Used on the Bakery
Using CAKE_ADMIN for multiple user types - By Egbert Teeselink
Hosting Admin URLs on a Subdomain - By Nate
This is what we added to our boostrap.php
Feedback is appreciated and hope this helps other people.
Resources Used on the Bakery
Using CAKE_ADMIN for multiple user types - By Egbert Teeselink
Hosting Admin URLs on a Subdomain - By Nate
This is what we added to our boostrap.php
Component Class:
Download code
<?php
$url = explode('.',env('HTTP_HOST'));
switch ($url[0]) {
case "admin":
Configure::write('Routing.admin', 'admin');
$_GET["url"] = "admin/" . str_replace('admin/','',$_GET['url']);
break;
case "support":
Configure::write('Routing.admin', 'support');
$_GET["url"] = "support/" . str_replace('support/','',$_GET['url']);
break;
default:
}
?>
Feedback is appreciated and hope this helps other people.
Comments
Comment
1 Security