i have url www.foo.com has 2 languages en , cn. have pages such about.php, product.php, etc.
i want url www.foo.com/about.php?lang=cn written www.foo.com/cn/about , same way, www.foo.com/en/product, etc.
i using nginx serving php website.
i able hide .php file
location / { try_files $uri $uri/ $uri.php?$query_string; } i tried writing this
location / { try_files $uri $uri/$query_string/ $uri.php?$query_string; } but somehow doesn't seem work.
add .htaccess file in folder.
.htaccess file:
rewriteengine on # turn on rewriting engine rewriterule ^([a-za-z0-9-]+)/about/?$ about.php?lang=$1 [nc,l] rewriterule ^([a-za-z0-9-]+)/product/?$ product.php?lang=$1 [nc,l]
Comments
Post a Comment