I have a Zend Framework application setup using modules. E.G. I have a “stock” module and a “transaction” module. I want to have multiple subdomains for these i.e. stock.website.com, transaction.website.com (so the DocumentRoot will be the same directory for each). The issue is, as they are Zend application ‘modules’ I would have to go stock.website.com/stock, or transaction.website.com/transaction.
I’m wondering if there’s a way to use a rewriteCond rule to identify the subdomain, and then treat all URLs loaded on that page as though they are from stock.website.com/stock, but only having stock.website.com in the adress bar?
At the moment, I have the standard htaccess rules for a zend application.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I suggest that you could use Zend Route Hostname for your solution as Zend will route the requests (not htaccess) to specific modules based on hostname, so you stresses on query string url would be not an issue then.
Basically, you can add to your application.ini like below (for modules only):
Then the rest just let Zend handle it.
Hope this would help you!