You can redirect all requests for one bucket to another bucket or URL by configuring Redirect requests in the Static Website Hosting dialog box.
All of the website files required by the static website have been uploaded to the specified bucket.
If the website files are Cold storage class, restored them first. For more information see Restoring a Cold File on OBS.
To ensure that a hosted static website can be accessed by all users, set anonymous users to be able to access static website files in the bucket. The configuration of static website hosting takes effect within two minutes after the configuration.
- In the bucket list on the OBS Console, click the target bucket to go to the Summary page.
- In the navigation tree on the left, click Static Website Hosting.
- Click the Static Website Hosting card, and select Redirect requests. In the Redirect To text box, enter a bucket access domain name or a URL. Figure 1 displays this page.
Figure 1 Redirection
- Click OK.
- In the bucket list, click the bucket to which requests for the static website are redirected.
- Optional: To ensure that a hosted static website can be accessed by all users, configure the following policy so that all static website files in the bucket can be accessed publicly.
- In the navigation tree on the left, click Objects.
- Click the target object and click Object ACL.
- In Object ACL > Public Permissions > Anonymous Users, click Edit to set an object read permission for anonymous users. This option is selected in Figure 2.
Figure 2 Setting an object read permission for anonymous users
- Click Save to save the permission setting.
If the bucket contains only static website files, configure the public read policy for the bucket so that all files in the bucket can be accessed publicly.
- Choose Permissions > Bucket Policy.
- Click the Public Read card to allow all objects in the bucket to be accessible publicly. This option is selected in Figure 3.
Figure 3 Configuring the public read permission
- Verify the configuration. Input the access domain name of the bucket in the web browser and press Enter. The bucket or URL to which requests are redirected will be displayed.
In some conditions, you may need to clear the browser cache before the expected results are displayed.