Trailing slash in the root URL is optional. You must upload the object with this name and configure it to be public and accessible. When configuring your bucket as a website, provide the name of the index document. In this case, OBS provides index documents, which are sometimes referred to as default pages. For example, if the user enters in the browser, the user does not request any specific page. Īn index document is a web page returned when a request is sent to the root of a site or any subfolder. For example, if you request the page ExamplePage.html and it causes an HTTP 404 error, the request will be redirected to the page report-404/ExamplePage.html on the If there is no routing rule and HTTP error 404 occurs, the error document specified in the configuration is returned. The following example also inserts the object name prefix report-404/ into redirection. Įxample 3: Redirecting when HTTP errors occurĪssume that the requested object is not found, and the request needs to be redirected to You can add redirection rules so that site visitors can redirect to when HTTP status code 404 (not found) is returned. You can add a routing rule that redirects the requests of all objects whose prefix is images/ to the page named folderdeleted.html. In this case, you can add the following routing rules to the website configuration: Įxample 2: Redirecting requests sent to deleted folders to a specified pageĪssume that you have deleted the images/ folder, that is, you have deleted all objects whose object name prefix is images/. For example, the request for docs/article1.html needs to be redirected to documents/article1.html. After the modification, the request for an object with prefix /docs needs to be redirected to another with documents/. You decide to change the folder name from docs/ to documents/. =įor request elements required for redirecting all requests sent to a specified website and for setting redirection rules, see Configuring Static Website Hosting for a Bucket – Request ElementsĮxample 1: Modifying the object name prefix for redirectionĪssume that your bucket contains the following objects: The content in square brackets is optional. The syntax format of RoutingRules is as follows. The syntax format is as follows by setting redirection rules of specific requests: You can add a routing rule that redirects requests to other objects. For example, assume that you delete or rename an object in a bucket. You can redirect requests based on the specific object name or prefix in the request, or based on the response code. If the root domain is and you need to respond to requests from and, you can create two buckets named and Then you can retain the website content in only one bucket (such as ), and configure the other bucket to redirect all requests to the bucket. For 4 XX errors, you can provide your own customized error document, or provide other guides to your users in this document. If an error occurs, OBS returns an HTML error document. When a request is sent to the root domain or any subfolder, OBS returns this index document. When you configure a bucket for website hosting, you must specify an index document. This default page is called an index document, and in most cases it is named as index.html. In this case, the web server will provide a default page that contains the directory that stores the requested website content. When you enter a URL such as, you are not requesting a specific page. The configuration includes the following information: If you want to use a bucket to host static websites, add the website configuration to the bucket.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |