SEO language URI redirection + existing directories

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


Hello,

I currently have URI built to have URI like
website.my/en
made to send the content from 'website.my' 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
website.my/ab
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
directive?

Thanks,
---
*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120615/729b55cf/attachment.html>


More information about the nginx mailing list