开发者

Handling URL rewriting for a multi-language website

开发者 https://www.devze.com 2023-01-10 15:41 出处:网络
I\'m working on a multi-language website and I\'m having a little trouble with rewriting URLs. So lets say I want to rewrite URLs for the products page. I must have 开发者_开发百科something like this

I'm working on a multi-language website and I'm having a little trouble with rewriting URLs.

So lets say I want to rewrite URLs for the products page. I must have 开发者_开发百科something like this:

http://www.mywebsite.com/products/some-product-name-34.html (for english)

http://www.mywebsite.com/produits/some-product-name-34.html (for french)

There will also be some static pages like a privacy policy page. I must have something like this:

http://www.mywebsite.com/privacy-policy.html (for english)

http://www.mywebsite.com/politique-de-confidentialite.html (for french)

Any ideea how I can accomplish this? Thanks.


This one would make the products accessible under its two names:

RewriteCond /products/some-product-name-34.html
RewriteRule /products/some-product-name-34.html /produits/some-product-name-34.html

That you have to do for all other files as well. Or if its just the directory, you like to rename

RewriteCond /products/(.*)$
RewriteRule /products/(.*)$ /produits/$1

would do.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号