CakePhp and subdomain routing -
i'm trying make subdomains working on website, however, still not able generate links subdomains...
i used code found in net:
<?php class subdomainroute extends cakeroute { public function match ($params) { $subdomain = isset($params['subdomain']) ? $params['subdomain'] : null; unset($params['subdomain']); $path = parent::match($params); if ($subdomain) { $path = 'http://' . $subdomain . '.localhost' . $path; } return $path; } }
but doesn't work me. tried find solution , got 1 please? thank you!
better late never guess, in order use above code have go app/config/routes.php
, use class:
app::uses('subdomainroute', 'routing/route');
as add route:
router::connect( '/:controller/:action/*', [ 'controller' => 'test' ], [ 'routeclass' => 'subdomainroute' ] );
hope helps... :)
Comments
Post a Comment