<p>Turns out the problem was with the Nginx config as Brad suggested. There was a question mark behind the <code>p=$1</code>. When we removed the <code>?</code> and restarted PHP it worked.</p>

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

location /en/ {
   try_files $uri $uri/ @enrewrites;
  }

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

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

CC BY-SA 3.0
2016-01-04T09:02:20.657Z
2016-01-04T09:02:20.657Z
KnutSv
<p>I have the strangest bug. I have a site with two languages, Norwegian and English. In my code i check for <code>craft.request.getQuery('prodid')</code>. Locally in Apache this works fine with both language URLs, but in production on Nginx, it only works on the Norwegian version (the main language).</p>

<p>The URLS looks like this</p>

<ul>
<li><a href="http://onepark.no/leie-parkering/paleet?prodid=1" rel="nofollow">http://onepark.no/leie-parkering/paleet?prodid=1</a></li>
<li><a href="http://onepark.no/en/rent-parking/paleet?prodid=1" rel="nofollow">http://onepark.no/en/rent-parking/paleet?prodid=1</a></li>
</ul>

<p>For the english URL (the second) <code>craft.request.getQuery('prodid')</code> returns an empty string. For the Norwegian URL it returns "1".</p>

<p>Nginx rewrite code:</p>

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

location /en/ {
   try_files $uri $uri/ @enrewrites;
  }

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

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

CC BY-SA 3.0
2015-12-21T18:52:58.707Z
Can you share/double check your nginx conf file?  My guess is that your rewrite rule is dropping all querystrings in the URL.
Brad Bell
CC BY-SA 3.0
2016-01-04T09:03:57.660Z
You were right, I'm not a server guy myself but noticed a question mark that was out of place, removing it fixed the issue.
KnutSv
<queries><language>
craft.request.getQuery returns empty on multi lingual site
# craft.request.getQuery returns empty on multi lingual site

(Asked by: username_0 on 2015-12-21)

I have the strangest bug. I have a site with two languages, Norwegian and English. In my code i check for craft.request.getQuery('prodid'). Locally in Apache this works fine with both language URLs, but in production on Nginx, it only works on the Norwegian version (the main language).
The URLS looks like this

http://onepark.no/leie-parkering/paleet?prodid=1
http://onepark.no/en/rent-parking/paleet?prodid=1

For the english URL (the second) craft.request.getQuery('prodid') returns an empty string. For the Norwegian URL it returns "1".
Nginx rewrite code:
location / {
    try_files $uri $uri/ @rewrites;
  }

location /en/ {
   try_files $uri $uri/ @enrewrites;
  }

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

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

**Tags:** queries, language
> **Comments:**
> **username_1**: Can you share/double check your nginx conf file?  My guess is that your rewrite rule is dropping all querystrings in the URL.  
> **username_0**: You were right, I'm not a server guy myself but noticed a question mark that was out of place, removing it fixed the issue.  

---

## 1 answers

### Answer by username_0 on 2016-01-04. Score: 1 | Accepted answer

Turns out the problem was with the Nginx config as Brad suggested. There was a question mark behind the p=$1. When we removed the ? and restarted PHP it worked.
location / {
    try_files $uri $uri/ @rewrites;
  }

location /en/ {
   try_files $uri $uri/ @enrewrites;
  }

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

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


---

