Convert the url to lowercase.
Son güncelleme:
21 May 2021
Question
How do we use mod_rewrite to convert URLs to lowercase and change docx extension to HTML?
Answer
-
RewriteMap tolower int:tolower RewriteRule ^([^/]+)/?$ somedir/${tolower:$1} [PT]
-
If it ends in .docx, change to .html
RewriteRule ^(.*?)\.docx(\?.*)$ $1.html$2 [PT]
-
Combined rewrite.
RewriteMap lowercase int:tolower RewriteRule (.*)\.[Dd][Oo][cC][xX](\?.*)?$ ${lowercase:$1}.html$2 [NC,R=301]