2016-04-12 34 views
1

我是新的cq5/aem url用选择器重写。我有以下方案来实现。你能帮我怎么做。cq5/aem url重写或映射调度程序和apache web服务器

我需要请求应该使用Apache Web服务器/调度程序配置和CQ5/AEM(ETC /地图)转换为

http://localhost:4502/content/myprojectroot/project1/en/batteries/search-results.toyota.corolla.2011.LE.html 

一个URL如

http://localhost:4502/batteries/toyota/corolla/2011/LE/ 

。请帮助我如何实现这一点。

回答

0

如果/etc/map下定义节点如下,在发布的过滤器将重新路由请求:

<?xml version="1.0" encoding="UTF-8"?> 
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" 
      jcr:primaryType="sling:Mapping" 
      sling:internalRedirect="[/content/myprojectroot/project1/en/batteries/search-results.$1.$2.$3.$4.html]" 
      sling:match=".+/batteries/(.*)/(.*)/(.*)/(.*)/"/> 

这sling.match让您根据组,然后使用$1语法捕捉匹配在重新路由URL中使用的部分。

然后,您只需确保调度程序允许初始URL模式。一旦调度员完成了它的工作,它就会将请求发送给发布者,然后在发布者上发送地图重定向将在请求被处理时发生。

另见https://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/resource-mapping.htmlhttps://docs.adobe.com/docs/en/dispatcher/disp-config.html

0

使用Apache的mod_rewrite做修改URL击中dispachter!

0

使用重写规则如下您虚拟主机

RewriteRule ^/batteries/toyota/corolla/2011/LE/ /content/myprojectroot/project1/en/batteries/search-results.toyota.corolla.2011.LE.html [R=301,L]