开发者

.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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜