Apache Rewrite Rules | AEM Dispatcher

Question

How do we use mod_rewrite to convert URLs to lowercase and change docx extension to HTML?

Answer

  1. Convert the url to lowercase.

    RewriteMap tolower int:tolower
    RewriteRule ^([^/]+)/?$ somedir/${tolower:$1} [PT]
  2. If it ends in .docx, change to .html

    RewriteRule ^(.*?)\.docx(\?.*)$ $1.html$2 [PT]
  3. Combined rewrite.

    RewriteMap lowercase int:tolower
    RewriteRule (.*)\.[Dd][Oo][cC][xX](\?.*)?$ ${lowercase:$1}.html$2 [NC,R=301]

 Adobe

Dapatkan bantuan lebih cepat dan lebih mudah

Pengguna baru?

Adobe MAX 2024

Adobe MAX
Konferensi Kreativitas

14–16 Oktober Miami Beach dan online

Adobe MAX

Konferensi Kreativitas

14–16 Oktober Miami Beach dan online

Adobe MAX 2024

Adobe MAX
Konferensi Kreativitas

14–16 Oktober Miami Beach dan online

Adobe MAX

Konferensi Kreativitas

14–16 Oktober Miami Beach dan online