我已经从Sling Resource Resolver Factory重写了以下网址:
/ - /
到
/内容/ myproject的/ EN /:/ EN /
并通过IIS我使用了以下重写规则:
<rewrite>
<globalRules>
<rule name="Root Context 1" enabled="true">
<match url="^(.*)\.html(.*)" />
<action type="Rewrite" url="/content/myproject/{R:1}.html{R:2}" appendQueryString="false" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.myproject.com" />
<add input="{REQUEST_URI}" pattern="^/etc/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/etc$" negate="true" />
<add input="{REQUEST_URI}" pattern="^/bin/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/system/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/libs/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/libs$" negate="true" />
<add input="{REQUEST_URI}" pattern="^/var/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/tmp/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/tmp$" negate="true" />
<add input="{REQUEST_URI}" pattern="^/crx/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/crx$" negate="true" />
<add input="{REQUEST_URI}" pattern="^/content/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/crxde$" negate="true" />
<add input="{REQUEST_URI}" pattern="^/apps/" negate="true" />
<add input="{REQUEST_URI}" pattern="^/apps$" negate="true" />
<add input="{REQUEST_URI}" pattern="^/scripts/disp_iis" negate="true" />
<add input="{REQUEST_URI}" pattern="^/dispatcher/invalidate" negate="true" />
</conditions>
</rule>
</globalRules>
<outboundRules>
<rule name="rewrite output" enabled="true">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/content/myproject/(.*)\.html(.*)$" />
<action type="Rewrite" value="/{R:1}.html{R:2}" />
<conditions>
</conditions>
</rule>
</outboundRules>
</rewrite>
默认的AEM搜索组件将在发布服务器localhost:4503 / en / search.html上工作,这是缩短的URL。如果我通过www.myproject.com/en/search.html它将无法工作,但是,如果我通过www.myproject.com/content/myproject/en/search.html
它会工作我已经尝试禁用IIS规则,我得到了相同的结果。这是怎么回事?