我有一个静态网站托管在S3上,包括/atom.xml
。在我的访问日志中,我看到/feed
和/atom
(没有扩展名)的请求,所以我想重定向它们。我可以配置一个S3静态站点来重定向一个确切的密钥吗?
我已经建立了重定向规则是这样的(由文档here描述):
<RoutingRules>
<RoutingRule>
<Condition><KeyPrefixEquals>feed</KeyPrefixEquals></Condition>
<Redirect><ReplaceKeyWith>atom.xml</ReplaceKeyWith></Redirect>
</RoutingRule>
<RoutingRule>
<Condition><KeyPrefixEquals>atom</KeyPrefixEquals></Condition>
<Redirect><ReplaceKeyWith>atom.xml</ReplaceKeyWith></Redirect>
</RoutingRule>
</RoutingRules>
第一个(feed -> atom.xml
)工作得很好,但第二个(atom -> atom.xml
)导致重定向循环,因为它与前缀的密钥匹配,而不是整个密钥。
我试着让匹配器atom/
,如果请求是/atom/
,但不适用于/atom
。
有没有办法让钥匙更智能一点?
可以用不同的前缀重命名使用atom.xml的东西 – at0mzk