3

I want to create routes to also get links like:

  • my.site.com(/:controller/:action)
  • admin.site.com(/:controller/:action)

I tried to add:

resources.router.routes.www.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.www.route = ":module.nameofmysite.com"
resources.router.routes.www.defaults.module = "default"
resources.router.routes.www.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.www.chains.index.route = ":controller/:action/*"
resources.router.routes.www.chains.index.defaults.controller = "index"
resources.router.routes.www.chains.index.defaults.action = "index"

But nothing happens.. (Server not found), how do I fix this?

I've read the zend documentation about this but I still can't get it to work.

Charles
  • 50,943
  • 13
  • 104
  • 142
Wouter Dorgelo
  • 11,770
  • 11
  • 62
  • 80
  • Your setup is correct (you don't have to specify the default values as default-values ;). If the error is "Server not found" this is not a PHP-problem but a server problem. Did you set up the subdomains before? – Fge Nov 03 '10 at 10:06
  • @Fge: nope, I installed Zend Server Community Edition and didn't set up any subdomains. – Wouter Dorgelo Nov 03 '10 at 10:13
  • I don't know the details how the domains are setup there. If I see this correct it uses apache too. So you have to tell apache about the subdomains before. By default it only knows the tld without subdomains. – Fge Nov 03 '10 at 10:29
  • I posted my settings from Apache and Hosts.. Strangely.. the non-subdomain routes do work, but the subdomain routes do not work. – Wouter Dorgelo Nov 03 '10 at 10:57
  • 2
    Try to add a ServerAlias *.local to your VirtualHost directive. Currently your VirtualHost isn't configured for any subdomain. – Fge Nov 03 '10 at 15:37

1 Answers1

3

I had a similar problem using wildcard subdomains on a local enviroment. I was sure of my routing however the hosts file didin't contain the subdomain. This worked for me

127.0.0.1  mydomain.local
127.0.0.1  subdomain.mydomain.local
Bangline
  • 890
  • 5
  • 11