tags:

views:

13

answers:

1

Hi everyone Currently developing a multi-lingual website, Users can access the front page using URL with format below:

http://example.com/en/
http://example.com/fr/

Problem is here. URL without last "/" (http://example.com/fr) caused page not found problem

Here is the rule

RewriteRule ^/?([^./]+)/(.*)$ $2?lang=$1 [L,QSA]

Can anybody help? Thanks in advance

A: 

Try this:

RewriteRule ^/?([a-z]{2})(/(.*))?$ $3?lang=$1 [L,QSA]

Another option would be to redirect if the trailing slash is missing:

RewriteRule ^/?[a-z]{2}$ %{REQUEST_URI}/ [L,R=301]
Gumbo
The first solution is working ! Thanks Gumbo !
Chris