.htaccess url masking
I have a couple of wordpress urls that I want to simplify for SEO purposes. I have http://www.example.com/fr/product-fr/review-fr/
I would like to change that to http:/开发者_开发百科/www.example.com/fr/product/review/ (remove -fr) but without changing the URL internally. So the user would access http://www.example.com/fr/product/review/ but the server would serve the content of http://www.example.com/fr/product-fr/review-fr/.
I want to do this to get around a URL problem with Wordpress and WPML.
Appreciate the help
Assuming the two letter lang code is always going to be constant throughout the URL:
RewriteEngine on
RewriteRule ^([A-Za-z]{2})/product/review$ /$1/product-$1/review-$1 [L,QSA]
should work a treat :)
P.S. the regexp takes any two-letter code (upper or lower case) so will work with other langs should you require.
Have you tried mod_rewrite
and Rewrite rules
?
Try:
^/([a-zA-Z]{2})/([^\/]+)/([^\/]+)/$ /$1/$2-$1/$3-$1
Haven't tested this though..
精彩评论