Knowledge base

Put Bucket Website

Sets the bucket website configuration. The user must be the bucket owner or to have been granted s3:PutBucketWebsite permission on the bucket.

PUT /?website HTTP/1.1
Host: {bucket}.{region}.cdn77-storage.com

Request Entries

NameDescription
WebsiteConfigurationnone

A container for the request.

IndexDocumentnone

A container for the suffix.

Suffixstring

Specifies the index document suffix.

ErrorDocumentnone

A container for the key.

Keystring

Object key name of the error document that will be used for 4XX errors coming from the bucket.

RoutingRulesnone

Container for Condition and Redirect.

Conditionnone


Used for describing the condition that needs to be met for the redirect to apply

HttpErrorCodeReturnedEqualsstring

HTTP error code when the redirect is applied.

KeyPrefixEqualsstring

The object key name prefix when the redirect is applied.

Redirectnone

Container for redirect information.

HostNamestring

The host to redirect.

HttpRedirectCodestring

The HTTP code to use on redirect.

Protocolstring

Protocol to use for the redirects. HTTP or HTTPS.

ReplaceKeyPrefixWithstring

The object key prefix to redirect to.

ReplaceKeyWithstring

The object key to use on redirect.

Example

<WebsiteConfiguration xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>
    <IndexDocument>
        <Suffix>index.html</Suffix>
    </IndexDocument>
    <ErrorDocument>
        <Key>error.html</Key>
    </ErrorDocument>
    <RoutingRules>
        <RoutingRule>
            <Condition>
                <KeyPrefixEquals>flowers/</KeyPrefixEquals>
            </Condition>
            <Redirect>
                <ReplaceKeyPrefixWith>img/flowers/</ReplaceKeyPrefixWith>
            </Redirect>
        </RoutingRule>
    </RoutingRules>
</WebsiteConfiguration>

Updated on 10th September, 2024

Can’t find what you are looking for?