Welcome! Log In Create A New Profile

Advanced

SEO language URI redirection + existing directories

B.R.
June 15, 2012 12:10PM
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.*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

SEO language URI redirection + existing directories

B.R. June 15, 2012 12:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 91
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready