Bucket Website Configuration Reference
A bucket website configuration is a set of files you can use as samples for your bucket website.
Indeed, a basic bucket website configuration contains at least an index and error HTML file, as well as a website configuration file.
While the index file (most commonly named index.html) is the default returned file when a user accesses the root of your domain, the error file (most commonly named error.html) is the file that is returned when an error occurs on your website.
However, the website configuration file, usually in JSON format, serves as a blueprint for how your bucket should behave when accessed as a website. In it, you can specify your index and error files as well as other configuration rules.
This page describes the elements you can specify in a bucket website configuration. Once you have written the necessary files, you need to apply them to your bucket. For more information, see Creating a Bucket Website.
Index and Error Files Samples
| Those are samples, meaning they are intentionally kept basic for testing purposes. | 
<!doctype html>
<html>
  <head>
    <title>My Bucket Website</title>
  </head>
  <body>
    <h1>Hi and welcome to my bucket website!</h1>
    <p>This website is static.</p>
  </body>
</html><!doctype html>
<html>
  <head>
    <title>404</title>
  </head>
  <body>
    <h1>Oops!</h1>
    <p>Looks like something went wrong here.</p>
  </body>
</html>Website Configuration Structure
| Certain attributes are mutually exclusive when configuring a bucket for website hosting, meaning they cannot be used together: 
 | 
Website Configuration Structure Using Redirections
{
    "RedirectAllRequestsTo": {
        "HostName": "www.example.com",
        "Protocol": "https"
    }
}| Attribute | Description | 
|---|---|
| 
 | When specified, all requests to the bucket are redirected to a specific hostname. | 
| 
 | Specifies the domain name to which all traffic from the bucket is redirected, making it a global redirection setting. | 
| 
 | The protocol to use for the redirection. Possible values are  | 
Website Configuration Structure Using Routing Rules
{
    "IndexDocument": {
        "Suffix": "index.html"
    },
    "ErrorDocument": {
        "Key": "error.html"
    },
    "RoutingRules": [
        {
            "Condition": {
                "HttpErrorCodeReturnedEquals": "404",
                "KeyPrefixEquals": "old-content/"
            },
            "Redirect": {
                "HostName": "www.example.com",
                "HttpRedirectCode": "302",
                "Protocol": "https",
                "ReplaceKeyPrefixWith": "new-content/"
            }
        },
        {
            "Condition": {
                "HttpErrorCodeReturnedEquals": "404",
                "KeyPrefixEquals": "old-file.html"
            },
            "Redirect": {
                "HostName": "www.example.com",
                "HttpRedirectCode": "302",
                "Protocol": "https",
                "ReplaceKeyWith": "new-file.html"
            }
        }
    ]
}| Attribute | Description | 
|---|---|
| 
 | Defines the default page serving as the index document for the bucket website. | 
| 
 | Specifies the file name of the index document, usually  | 
| 
 | Defines the returned error document when 4xx client errors occurs. A 4xx client error happens when the request either contains bad syntax or cannot be fulfilled. | 
| 
 | Specifies the file name of the error document, usually  | 
| 
 | Defines the rules to redirect requests, under specific conditions. | 
| 
 | Defines the condition under which the specified redirection is applied. | 
| 
 | The HTTP error code triggering the redirection. Commonly used codes include  | 
| 
 | The prefix of the requested object key triggering the redirection in the bucket. This can be set to redirect requests for entire directories or specific files. For instance, using  | 
| 
 | Specifies the redirect action that should be taken when the condition is met. | 
| 
 | Specifies the domain name where requests are redirected based on specific conditions. This is useful for targeted redirection. | 
| 
 | The HTTP status code to return for the redirection ( | 
| 
 | The protocol to use for the redirection. Possible values are  | 
| 
 | Specifies the string to replace the key prefix matched by  | 
| 
 | Defines the specific key to use in the redirect request. This replaces the entire key matched by the condition. |