Updated on 2024-04-01 GMT+08:00

Configuring Redirection

You can redirect all requests for a bucket to another bucket or URL by configuring redirection rules.

Prerequisites

Web page files required for static website hosting have been uploaded to the specified bucket.

The static website files hosted in the bucket are accessible to anonymous users.

Static web page files in the Archive storage class have been restored. For more information, see Restoring an Object from Archive Storage.

Procedure

  1. In the navigation pane of OBS Console, choose Object Storage.
  2. In the bucket list, click the bucket you want to operate to go to the Objects page.
  3. In the navigation pane, choose Overview.
  4. In the Basic Configurations area, click Static Website Hosting. The Static Website Hosting page is displayed.

    Alternatively, you can choose Basic Configurations > Static Website Hosting from the navigation pane on the left.

  5. Click Configure Static Website Hosting. The Configure Static Website Hosting dialog box is displayed.
  6. Enable Status.
  7. Set Hosting Type to Redirect requests, as shown in Figure 1. In the text box of Redirect To, enter the bucket's access domain name or URL.

    Figure 1 Configuring redirection

  8. Click OK.
  9. In the bucket list, click the bucket to which requests for the static website are redirected.
  10. (Optional) If the static website files in the bucket are not accessible to anonymous users, perform this step. If they are already accessible to everyone, skip this step.

    Grant the read permission for static website files to anonymous users. For details, see Granting Public Read Permissions on Objects to Anonymous Users.

    If the bucket contains only static website files, configure the Public Read policy for the bucket so that all files in it are publicly accessible.

    1. Choose Permissions > Bucket Policy.
    2. Click Create Bucket Policy.
    3. In the template list, locate Public Read in the Template Name column and click Use Policy Template on the right.
      Figure 2 Configuring the public read permission
    4. Keep the default settings of the template and click Next and then Create.

  11. Verification: 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.