简体   繁体   English

Amazon S3:如何对图像使用SEO友好的URL

[英]Amazon S3: How to use SEO-friendly URLs for Images

we are using Amazon S3 for displaying images on our website. 我们正在使用Amazon S3在我们的网站上显示图像。 Right now, the images are saved with the keys: 现在,使用以下键保存图像:

myimages/193-image-small.jpg
myimages/193-image-large.jpg
myimages/194-image-small.jpg
myimages/194-image-large.jpg

and so on... 等等...

I can embed an image in my page with a code like this: 我可以使用以下代码在页面中嵌入图片:

<img src="s3-zone.amazonaws.com/mybucket/myimages/193-image-large.jpg">

This is working nice and properly but I want to go a step further and display SEO friendly picture URLs for google like: 这工作正常且正常,但我想更进一步,为Google显示SEO友好图片网址,例如:

s3-zone.amazonaws.com/mybucket/myimages/193-super-great-title-for-my-picture.jpg

Is that in any way possible to implement and if yes - how? 有可能以任何方式实施,如果可以的话,如何进行?

This is not possible. 这是不可能的。 Each object in Amazon S3 has one Key Name. Amazon S3中的每个对象都有一个键名。

Some options: 一些选项:

  • Rename the objects to the name you desire, or 将对象重命名为所需的名称,或者
  • Point the URLs to your web server, which can translate the URL to the 'normal' URL and retrieve the underlying S3 object -- but this will put load on your web server rather than sending all requests to S3 将URL指向您的Web服务器,这可以将URL转换为“普通” URL并检索底层的S3对象-但这将给您的Web服务器增加负载,而不是将所有请求发送到S3

If you want to be SEO-friendly, it's much better to add an alt field to the img tag. 如果您想对SEO友好,最好在img标签中添加一个alt字段。 That counts more than filenames. 这比文件名更重要。

For example, see: How to Optimize Images for Better Search Engine Rankings 例如,请参阅: 如何优化图像以提高搜索引擎排名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM