2014-01-06 29 views
0

我想将网址“http://mydomain.com/s3?file=test”重定向到“http://mydomain.com/s3/test.js”,其中mydomain.com是一个S3静态网站。如何使用查询字符串参数重定向S3网址?

基于文档,除非我使用Web服务器,但是我不知道是否有办法通过S3重定向完成此操作(http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.htmlhttp://docs.aws.amazon.com/AmazonS3/latest/dev/HowDoIWebsiteConfiguration.html)。

回答

0

是的,您可以通过指定重定向规则,同时将s3存储区配置为静态网站来实现此目的。

根据您的需求量的重定向规则将是:

<RoutingRules> 
    <RoutingRule> 
     <Condition> 
      <KeyPrefixEquals>?file=test</KeyPrefixEquals> 
     </Condition> 
     <Redirect> 
      <ReplaceKeyPrefixWith>s3/test.js</ReplaceKeyPrefixWith> 
     </Redirect> 
    </RoutingRule> 

希望这将有助于

+6

是否可以动态地做到这一点?即file = test1进入s3/test1.js,file = test123进入s3/test123.js等。或者我需要为每个手动定义规则吗? –

相关问题