<p>Ok, I got it working with:</p>

<p>nginx vhost config:</p>

<pre><code>location /en/ {
    try_files $uri $uri/ @enrewrites;
}

location /nl/ {
    try_files $uri $uri/ @nlrewrites;
}

location / {
    try_files $uri $uri/ @rewrites;
}

location @enrewrites {
    rewrite ^/en/(.*)$ /en/index.php?p=$1 last;
}

location @nlrewrites {
    rewrite ^/nl/(.*)$ /nl/index.php?p=$1 last;
}

location @rewrites {
    rewrite ^(.*) /index.php?p=$1 last;
}
</code></pre>

<p>And in general craft config:</p>

<pre><code>'omitScriptNameInUrls' =&gt; true,
</code></pre>

CC BY-SA 3.0
2015-05-29T18:29:31.753Z
Found this useful, new to Craft so I set it in a different general.php, this is what got me up and running http://buildwithcraft.com/help/why-index.php
Brad
CC BY-SA 3.0
2014-08-19T09:35:06.030Z
2015-08-10T20:10:34.900Z
2015-08-10T20:10:34.900Z
maunoxyd
<p>I have a localized site, localization works fine for homepage (/en/), however the links to other page does not work (/en/rooms) where /chambres works fine for default language.</p>

<p>The English 'chambres' page is accessible with /en/?p=rooms</p>

<p>I would like the english page being accessible with /en/rooms</p>

<p>It's definitely an Nginx vhost config issue. The config listed in <a href="https://craftcms.stackexchange.com/questions/780/locales-sub-directories-on-nginx">Locales sub directories on Nginx</a> didn't solve my problem.</p>

<p>This is my english index.php:</p>

<pre><code>// Tell Craft to serve the English content
define('CRAFT_LOCALE', 'en');
</code></pre>

<p>This is in my general config file:</p>

<pre><code>'quartiergeneral.craft.dev' =&gt; array(
        'devMode' =&gt; true,
        'usePathInfo' =&gt; true,
        'omitScriptNameInUrls' =&gt; true,
        'environmentVariables' =&gt; array(
            'basePath' =&gt; '/home/vagrant/Code/quartiergeneral/craft/public/',
            'baseUrl'  =&gt; 'http://quartiergeneral.craft.dev:8000/',
        ),
        'siteUrl' =&gt; array(
            'fr' =&gt; 'http://quartiergeneral.craft.dev:8000/',
            'nl' =&gt; 'http://quartiergeneral.craft.dev:8000/nl/',
            'en' =&gt; 'http://quartiergeneral.craft.dev:8000/en/',
        ),
    ),
</code></pre>

<p>This is my nginx config vhost:</p>

<pre><code>server {
    listen 80;
    server_name quartiergeneral.craft.dev;
    root /home/vagrant/Code/quartiergeneral/craft/public;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ @rewrites;
    }

    location @rewrites {
        rewrite ^(.*) /index.php?p=$1 last;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/quartiergeneral.craft.dev-error.log error;

    error_page 404 /index.php;

    sendfile off;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}
</code></pre>

CC BY-SA 3.0
2014-08-17T21:05:30.653Z
For those who can't see deleted answers, maunoxyd solved the problem by changing the section type from single, which was accidentally selected, to channel.
carlcs
CC BY-SA 3.0
2014-08-17T21:08:00.587Z
maunoxyd, could you please add a new answer. Or, if you don't want this Q/A to exist, delete your question? Thanks.
carlcs
CC BY-SA 3.0
2014-08-18T09:25:49.370Z
No the issue is still happening, as it is in the above question. Previously I didn't get the link to work in other language, which now works but not without parameters in url
maunoxyd
CC BY-SA 3.0
2014-08-18T09:49:16.727Z
Sorry maunoxyd, I read your (deleted) answer as if you solved the problem. Maybe you can find a solution here: [Locales sub directories on Nginx](http://craftcms.stackexchange.com/questions/780/locales-sub-directories-on-nginx)
carlcs
<localization><slug><nginx>
Nginx Vhost Config - Get page based on translated URI and without parameters in url
# Nginx Vhost Config - Get page based on translated URI and without parameters in url

(Asked by: username_0 on 2014-08-17)

I have a localized site, localization works fine for homepage (/en/), however the links to other page does not work (/en/rooms) where /chambres works fine for default language.
The English 'chambres' page is accessible with /en/?p=rooms
I would like the english page being accessible with /en/rooms
It's definitely an Nginx vhost config issue. The config listed in Locales sub directories on Nginx didn't solve my problem.
This is my english index.php:
// Tell Craft to serve the English content
define('CRAFT_LOCALE', 'en');

This is in my general config file:
'quartiergeneral.craft.dev' => array(
        'devMode' => true,
        'usePathInfo' => true,
        'omitScriptNameInUrls' => true,
        'environmentVariables' => array(
            'basePath' => '/home/vagrant/Code/quartiergeneral/craft/public/',
            'baseUrl'  => 'http://quartiergeneral.craft.dev:8000/',
        ),
        'siteUrl' => array(
            'fr' => 'http://quartiergeneral.craft.dev:8000/',
            'nl' => 'http://quartiergeneral.craft.dev:8000/nl/',
            'en' => 'http://quartiergeneral.craft.dev:8000/en/',
        ),
    ),

This is my nginx config vhost:
server {
    listen 80;
    server_name quartiergeneral.craft.dev;
    root /home/vagrant/Code/quartiergeneral/craft/public;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ @rewrites;
    }

    location @rewrites {
        rewrite ^(.*) /index.php?p=$1 last;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/quartiergeneral.craft.dev-error.log error;

    error_page 404 /index.php;

    sendfile off;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

**Tags:** localization, slug, nginx
> **Comments:**
> **username_1**: For those who can't see deleted answers, maunoxyd solved the problem by changing the section type from single, which was accidentally selected, to channel.  
> **username_1**: maunoxyd, could you please add a new answer. Or, if you don't want this Q/A to exist, delete your question? Thanks.  
> **username_0**: No the issue is still happening, as it is in the above question. Previously I didn't get the link to work in other language, which now works but not without parameters in url  
> **username_1**: Sorry maunoxyd, I read your (deleted) answer as if you solved the problem. Maybe you can find a solution here: [Locales sub directories on Nginx](http://craftcms.stackexchange.com/questions/780/locales-sub-directories-on-nginx)  

---

## 1 answers

### Answer by username_0 on 2014-08-19. Score: 5 | Accepted answer

Ok, I got it working with:
nginx vhost config:
location /en/ {
    try_files $uri $uri/ @enrewrites;
}

location /nl/ {
    try_files $uri $uri/ @nlrewrites;
}

location / {
    try_files $uri $uri/ @rewrites;
}

location @enrewrites {
    rewrite ^/en/(.*)$ /en/index.php?p=$1 last;
}

location @nlrewrites {
    rewrite ^/nl/(.*)$ /nl/index.php?p=$1 last;
}

location @rewrites {
    rewrite ^(.*) /index.php?p=$1 last;
}

And in general craft config:
'omitScriptNameInUrls' => true,

> **Comments:**
> **username_2**: Found this useful, new to Craft so I set it in a different general.php, this is what got me up and running http://buildwithcraft.com/help/why-index.php  

---

