Basic Concepts
A static website refers to a website that contains static content (such as HTML) or client scripts. Users can configure the static website through the console for the storage bucket bound with custom domains. The content of dynamic websites contains server-side scripts such as PHP, JSP, or ASP.NET, which need to rely on server-side processing. COS supports hosting static websites but does not support server-side scripting. When you need to deploy dynamic websites, it is recommended to use CVM for server-side code deployment.
Example
The user created a bucket named examplebucket-1250000000 and uploaded the following files:
index.html
404.html
403.html
test.html
docs/a.html
images/
Static Website
Before enabled: Access the bucket via the following default domain name. When a download prompt pops up, save the index.html file to the local.
https://examplebucket-1250000000.cos-website.city.yfm4.fsphere.cn/index.html
After enabled: Access the bucket via the following access node, and then you can view the content of index.html directly in the browser.
https://examplebucket-1250000000.cos-website.city.yfm4.fsphere.cn/index.html
Index Document
An index document, the homepage of the static website, is a page returned when the root directory or any subdirectory of a website is requested and is usually named index.html.
When you access a static website via a bucket access domain name, such as https://examplebucketbucket-1250000000.cos-website.city.yfm4.fsphere.cn, and no specific page is requested, in this case, the Web server will return the homepage.
When your user accesses any directory (including the root directory) in a bucket using a URL ending with /, the index document in that directory will be matched preferentially. / is not mandatory in the root URL, so the index document is returned in response to either of the following URLs.
http://www.examplebucket.com/
http://www.examplebucket.com
Note:
If a folder is created in the bucket, the index document needs to be added at each level of the folder.
Error Document
Assume that when you visit the following page before configuring the error document, a 404 status code is returned, and the default error information is displayed on the page.
https://examplebucket-1250000000.cos-website.city.yfm4.fsphere.cn/webpage.html
When you visit the following page after configuring the error document, a 404 status code is also returned, but the specific error information is displayed on the page.
https://examplebucket-1250000000.cos-website.city.yfm4.fsphere.cn/webpage.html
Redirection Rules
Note:
To configure redirection rules for a hosted static website, the path of the replacement document must be an object path in your bucket.
Configuring Error Code Redirection
If the webpage.html document is set to Private Read/Write public assess permission, when a user tries to access it, a 403. 403 error is returned.
After the 403 error code is redirected to 403.html, the browser will return the content of 403.html.
If you do not configure a 403.html document, the browser will return an error document or default error message.

Configuring Prefix Match
- When you rename a folder from docs/ to documents/, the user will get an error when accessing the docs/ folder. So, you can redirect the request with the prefix docs/ to documents/.

- you can add a redirection rule to redirect requests for any object with the prefix
images/totest.html. You can add a redirection rule to redirect requests for any object with the prefiximages/totest.html.

