Html 亚马逊 S3 和 .htaccess
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14095818/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Amazon S3 and .htaccess
提问by Undo
I have a site (Made in iWeb) that I am hosting on Amazon S3. I am trying to get www.domain.com/Apps/Physics.html
to turn into www.domain.com/Apps/Physics
.
我有一个在 Amazon S3 上托管的网站(iWeb 制造)。我正试图www.domain.com/Apps/Physics.html
变成www.domain.com/Apps/Physics
.
I am trying to accomplish this with an .htaccess file. The file is stored in the root of the bucket (where the index.html file is). Here's the problem: It doesn't work. Still can't use www.domain.com/Apps/Physics
.
我正在尝试使用 .htaccess 文件来完成此操作。该文件存储在存储桶的根目录中(index.html 文件所在的位置)。问题是:它不起作用。还是不能用www.domain.com/Apps/Physics
。
I have a GoDaddy domain, hosted on the S3 server. Does this help?
我有一个托管在 S3 服务器上的 GoDaddy 域。这有帮助吗?
采纳答案by greenimpala
S3 is a content server and nota web server. You may want to try renting a small Amazon EC2instance with Apache to do what you want.
S3 是内容服务器,而不是Web 服务器。您可能想尝试租用一个带有 Apache的小型Amazon EC2实例来做您想做的事。
回答by Aniruddh Joshi
Why don't you add CNAME record 'static' for domain.com (this one for S3) and host www on a Apache server and a rewrite rule like this:
为什么不为 domain.com 添加 CNAME 记录“静态”(这个用于 S3)并在 Apache 服务器上托管 www 和这样的重写规则:
RewriteEngine On
RewriteRule ^somefolder/(.*)$ http://static.domain.com/ [P]
OR
或者
#This will save your time of creating the additional CNAME step
RewriteEngine On
RewriteRule ^somefolder/(.*)$ http://yourbucket.s3.amazonaws.com/ [P]
EDIT: Using mod proxy seems to be a better option.
编辑:使用 mod 代理似乎是一个更好的选择。
回答by Kristof Van Landschoot
Anno 2016 Amazon S3 supports redirects.
Anno 2016 Amazon S3支持重定向。