更新时间:2023-10-21 13:35:22
在您的 VirtualHost
部分中定义此 RewriteMap
并重新启动 Apache:
Define this RewriteMap
in your VirtualHost
section and restart Apache:
RewriteMap lc int:tolower
然后在站点根目录 .htaccess 里面有这个代码:
Then inside site root .htaccess have this code:
RewriteEngine On
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} (/product-category/subcategory)/?\?id=([^\s&]+) [NC]
RewriteRule ^ %1/${lc:%2}? [R=301,L,NE]
# internal forward from pretty URL to actual one
RewriteRule ^(product-category/subcategory)/(\w-]+)/?$ $1/?id=$2&fromDate=&parts= [L,QSA,NC]
${lc:%2}
会将 %2
中的值转换为小写.
${lc:%2}
will convert value in %2
to lowercase.