Welcome! Log In Create A New Profile

Advanced

rewrite rule needed for subdomains

Mike Smith
November 03, 2009 03:12PM
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/.
Subject Author Posted

rewrite rule needed for subdomains

Mike Smith November 03, 2009 03:12PM

Re: rewrite rule needed for subdomains

Igor Sysoev November 03, 2009 04:02PM

Re: rewrite rule needed for subdomains

Mike Smith November 03, 2009 04:22PM

Re: rewrite rule needed for subdomains

Igor Sysoev November 03, 2009 04:40PM

Re: rewrite rule needed for subdomains

Mike Smith November 04, 2009 01:18PM

Re: rewrite rule needed for subdomains

edogawaconan November 05, 2009 02:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 91
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready