从 Google 云存储中的 URL 中排除“.html”

Exclude ".html" from URL's in Google Cloud Storage

是否可以使用 Google 云存储让 www.mydomain.com/testingwww.mydomain.com/testing.html 提供服务?

我使用 htaccess:

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ .html [NC,L]

没有。您可以指定哪个对象代表您网站的根目录(例如,当用户访问 www.domain.com/ 时提供 index.html),但这是一种特殊情况。不支持任意 URL 重写规则。

您可以配置的值记录在此处:https://cloud.google.com/storage/docs/website-configuration#step4

jterrace :

You can serve HTML content without a .html suffix. It's important to set the content-type though. For example, with gsutil:

gsutil -h "Content-Type:text/html" cp /path/users/userProfile \
    gs://www.website.com/userProfile