SEO language URI redirection + existing directories

B.R. reallfqq-nginx at
Fri Jun 15 16:07:25 UTC 2012


I currently have URI built to have URI like
made to send the content from '' in the en language.

My Ngingx conf is as follows:
location ~* "^/[a-z]{2}(/.*)?$" {
    rewrite "^/([a-z]{2})/?$" /index.php?lang=$1 last;
    rewrite "^/([a-z]{2})(/[^\.]+)$" $2/index.php?lang=$1 last;
    rewrite "^/([a-z]{2})(/.+)$" $2 last;

I also have some 2-letters top-level directories which I want to send with
the highest priority.

I would like that
checks if /ab directory (or file) exists and:
- process its content as usual if it's the case
- redirects through the language rules if it's not

Is there a way to make some conditional rewrite based on the try_files

*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list