rewrite rule needed for subdomains
Mike Smith
lists at ruby-forum.com
Tue Nov 3 23:03:22 MSK 2009
We have a lot of magento stores that work like
store1.domain.com
store2.domain.com
so a user can go into store1.domain.com/products/ and the url will stay
there
We do this in apache like
RewriteCond %{HTTP_HOST} !^(host)\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !^(www)\.domain\.com [NC]
RewriteRule ^(.*) /magento/$1 [L]
We also have a dns catchall that will send all *.domain.com to a default
apache vhost. I'm slamming my head against the wall to get it working in
nginx to keep the hostname the same but behind the scenes rewrite the
domain for magento to parse.
Here is what I have but it just keeps appending /magento/magento/magento
to the end till it kills the loop
if ($http_host !~ "^www.domain\.com$") {
rewrite ^.+ http://$http_host/magento/$uri last;
break;
}
Thanks!
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list