What I'm trying to do is use the subdomain for the special mobile version of my ZF application. Ideally, this would compare with a specific controller, as an example below, but at this point I am ready to try any method that works:
Ex. m.domain.com/action will be redirected to the "mobile" controller and any action is indicated.
I found a number of similar questions here and elsewhere on Google, but I feel like I'm missing something obvious, because no matter which route I set up, it is simply ignored. I suspect it has something to do with htaccess, but it may not be so.
Here is the route that I have in my boot file (but I tried several different patterns here). Right now I'm just trying to get it to show a simple index for simplicity:
$hostRoute = new Zend_Controller_Router_Route_Hostname(':subdomain.domain.com', array( 'controller' => 'index', 'action' => 'index' ) ); $plainPathRoute = new Zend_Controller_Router_Route(':controller/:action/*', array('controller' => 'index', 'action' => 'index')); $controller->getRouter()->addRoute('mobile', $hostRoute->chain($plainPathRoute));
And my htaccess has:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]
Now I have two methods, because I was so upset.
- Create subdomain "m" inside my hosting account
- The subdomain "application" does not exist on my web hosting account
For method 1, it simply goes into the general index.html file, which is located in domain.com/m/. Method 2 tells me that the page does not exist.
I really hope that there is something obvious here that I am missing. As I mentioned above, I am not picky about how this is done if I have a subdomain pointing to a specific controller. This will be a very simplified version of the site, so I donβt need to do anything complicated.
Thank you for your help.