rewrite rule needed for subdomains

Mike Smith lists at ruby-forum.com
Wed Nov 4 00:19:09 MSK 2009


Igor Sysoev wrote:
> On Tue, Nov 03, 2009 at 09:03:22PM +0100, Mike Smith wrote:
> 
>>     RewriteCond %{HTTP_HOST} !^(host)\.domain\.com [NC]
>> to the end till it kills the loop
>> 
>>         if ($http_host !~ "^www.domain\.com$") {
>>             rewrite ^.+ http://$http_host/magento/$uri last;
>>             break;
>>         }
> 
>     server {
>         # a catchall server for "listen 80",
>         # since it's "default" server for "listen 80"
> 
>         listen 80 default;
>         server_name  store1.domain.com;
> 
>         location / {
>             rewrite ^   http://$host/magento/$request_uri? last;
>         }
> 
>         location /magento/ {
>             ...
>         }
>     }
> 
>     server {
>         listen 80;
>         server_name  www.domain.com  host.domain.com;
>         ...
>     }

That works but it changes the browser URL and adds /magento/ in there 
and that can't happen

When I go to http://store1.domain.com/products/

it gets changed to http://store1.domain.com/magento/products/

I just need the /magento/index.php to parse it via the URI
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list