.htaccess redirection with chars manipulation
Is there an way I can use a regex to redirect (301) URLs int he .htacces in a way that domain.com/My_Name.html
will be redirected to domain.com/my-name
?
Need to replace all _
with -
, lower case the chars and subtract the ".html"
EDIT:
I need to replace all _
chars, no matter how many of them are in the URL开发者_Python百科.
RewriteEngine on
RewriteRule ^(\w+)_(\w+)\.html$ ${tolower:$1}-${tolower:$2}
Not yet tested, but I'm pretty sure this will work.
精彩评论