Quantcast
Viewing all articles
Browse latest Browse all 49202

NginX, Multisite and Rewrite rules

I'm looking for some help with rewrite rules and multisite. I would like to have the following set up:

  1. The "Main" Drupal site, hosted at www.example.com and with all of its modules and themes at /sites/example.com
  2. A "Sub" Drupal site, hosted at www.example.com/subsite and with all of its modules and themes at /sites/example.com.subsite

So far #1 works beautifully with the following rewrite rule:

location / {
                root /www/example;
                index index.php index.html;

                if (!-e $request_filename) {
                        rewrite ^/(.*)$ /index.php?q=$1 last;
                        break;
                }
        }

I haven't been able to get #2 working, though. I've tried many different rewrite rules, most of which give me a "404" or "no input file specified. I was thinking it would be something like:

location ~^ /subsite/ {
             root /www/example;
             rewrite ^/subsite/(.*)$ ^/index.php?q=$1 last;
}

but that doesn't seem to work.

Any pointers out there?


Viewing all articles
Browse latest Browse all 49202

Trending Articles