I'm having a bit of a trouble with nginx and rewriting. Searching on the internet only shows results for rewriting domains or changing request_uri's, but I'm trying to rewrite part of the uri.

Whenever a client connects to site.com it should go to site.com/en but when it connects to site.nl it should go to site.nl/nl (both on the same root files). They're both in their own server block, with the following rewrite rule:

rewrite ^ /en/$request_uri;

This one doesn't really work and also rewrites all the paths to the css and images. Now the biggest problem is probably that there's already a drupal rewrite:

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

Is there any way to combine these or another way to let the user go to the correct url with /en or /nl? Or would this work in Apache?

Edit: I ended up using apache, since that has a simple redirect:

RewriteEngine On
RedirectMatch permanent ^/$ /en
link|improve this question
What do you want with css and images? Could you please elaborate more details? – quanta Sep 22 '11 at 16:44
the css is normally on /sites/default/files, but this also rewrote it to /en/sites/default/files, so those would be inaccesible. Regardless, I went with apache – XSlicer Sep 26 '11 at 11:23
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.