这取决于您指的是哪种重写。入站或出站。
当涉及入站重写时,我建议使用 mod_rewrite 并使用一条规则正确地重写您的内容 - 这非常有效。
当涉及到出站重写(处理 html 中的链接)时,您绝对应该使用 Sling Mappings - 因为它们更有效和清晰 - 它们就是为此目的而设计的。
看看这个博客,它解释了整个重写过程:https : //www.cognifide.com/our-blogs/cq/multidomain-cq-mappings-and-apache-configuration/
对于Sling中的问题,总是有多种选择。如果查看“ URL重写”主题,它有两个维度:
/content/path/en/about.html到/en/about//en/about/到资源请求/content/path/en/about.html出站:URL重写通常由LinkRewriter / TransformerFactory进行出站。从理论上讲,您还可以更改组件以进行不同的渲染或更改内容。但这是不推荐的。要应用变形金刚,您可以使用
入站:之前,您的入站请求可以在Sling或基础结构级别上重写或映射(Apache HTTPD mod_rewrite或CDN sa Akamai)
高温超导
[1] https://docs.adobe.com/docs/zh-CN/aem/6-2/deploy/configuring/resource-mapping.html
[2] https://sling.apache.org/documentation/the-sling-engine/filters.html
[3] https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html