I have the following mod_rewrite rule
RewriteCond %{HTTP_HOST} !^(host)\.doamin\.com [NC]
RewriteCond %{HTTP_HOST} !^(www)\.domain\.com [NC]
RewriteRule ^(.*) /magento/$1 [L]
I need that to work in nginx and I've been slamming my head against the wall to make it work
Thanks!
UPDATE!
Here is a better explanation of what I'm trying to do
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;
}
The problem with the above is it keeps rewritting it as
store1.domain.com/magento/
store1.domain.com/magento/magento/
store1.domain.com/magento/magento/magento/ and so on
Here is a error log for it
2009/11/03 15:40:26 [error] 22347#0: *2 rewrite or internal redirection cycle while processing "/magento//magento//magento//magento//magento//magento//magento//magento//magento//magento//magento//catalogsearch/advanced/result/", client: 127.0.0.1, server: laptop, request: "GET /catalogsearch/advanced/result/?featured=1 HTTP/1.1", host: "store1.domain.com"