upload method

Uploads configuration of static website hosting for a bucket.

Request

PUT /{bucket}?website HTTP/1.1

Path parameters

Parameter Description
bucket Name of the bucket.

Query parameters

Parameter Description
website Mandatory parameter to indicate the type of operation.

Headers

In a request, use the necessary common request headers.

Data schema

You can configure a bucket:

Sample configuration:

<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <IndexDocument>
        <Suffix>index.html</Suffix>
    </IndexDocument>
    <ErrorDocument>
        <Key>Error.html</Key>
    </ErrorDocument>
</WebsiteConfiguration>

Possible elements:

Element Description
IndexDocument/Suffix The website's home page.

Path: /WebsiteConfiguration/IndexDocument/Suffix.
ErrorDocument/Key Document that the user will see if a 4xx error occurs.

Path: /WebsiteConfiguration/ErrorDocument/Key.

Sample configuration:

<!--Configuration for redirecting all requests-->
<WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <RedirectAllRequestsTo>
        <HostName>example.com</HostName>
        <Protocol>http</Protocol>
    </RedirectAllRequestsTo>
</WebsiteConfiguration>

Possible elements:

Element Description
RedirectAllRequestsTo Contains redirect configuration for all requests.

Path: /WebsiteConfiguration/RedirectAllRequestsTo.
HostName Host to which all requests to the bucket are redirected.

Path: /WebsiteConfiguration/RedirectAllRequestsTo/HostName.
Protocol Protocol used for redirects: http or https. Optional element.

Path: /WebsiteConfiguration/RedirectAllRequestsTo/Protocol.

Response

Headers

A response can only contain common response headers.

Response codes

For a list of possible responses, see Responses.