rewrite don't work in a multilanguage MVC site
Fernando García Torres
olfativo at hotmail.com
Tue Oct 25 18:17:48 UTC 2011
Tried, and same results, redirect OK but 404 response.
Thanks!!
> Date: Tue, 25 Oct 2011 18:15:38 +0100
> From: appa at perusio.net
> To: nginx at nginx.org
> Subject: Re: rewrite don't work in a multilanguage MVC site
>
> On 25 Out 2011 17h56 WEST, olfativo at hotmail.com wrote:
>
> > [1 <multipart/alternative (7bit)>]
> > [1.1 <text/plain; iso-8859-1 (quoted-printable)>]
> >
> > Hi!Im trying to move from Apache to nginx (v1.1.6), but you know,
> > rewrite newbie here... In my site when a user types http://site.com
> > he's redirected to http://site.com/en/, and all the other URLs are
> > internally handled by an index.php. This is my actual Apache
>
> Try this:
>
> At the http level.
>
> map $http_accept_language $is_english {
> default 0;
> ~^en 1;
> }
>
> map $http_accept_language $is_spanish {
> default 0;
> ~^es 1;
> }
>
> location / {
>
> expires 30d;
>
> if ($is_english) {
> return 301 /en;
> }
>
> if ($is_spanish) {
> return 301 /es;
> }
>
> location /es {}
>
> location /en {}
>
> try_files $uri $uri/ /index.php?ctr=$uri;
> }
>
> location ~\.php$ {
> # PHP stuff
> }
>
> --- appa
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20111025/387780fb/attachment-0001.html>
More information about the nginx
mailing list