Query regarding subdomain redirection in Zend Framework
I was looking for an approach using Zend Framework - similar to sites like bit.ly and tinyurl - 开发者_JAVA百科where I can take a request to a subdomain and store the subdomain in a variable.
For instance, a request to localhost/abcdef will return $s = abcdef. I'm not sure how to accomplish this in ZF, where a request to localhost/abcdef will return the init() of the abcdef controller.
Thanks for all the help!
Just use a regex route.
$routeitem = new Zend_Controller_Router_Route_Regex('(.*)',
array(1 => '', 'controller' => 'redir', 'action' => 'view'),
array(1 => 'hash'),
'%s'
);
You can then get your "hash" redirection from the _getParam method.
精彩评论