forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Jawei, Li <lijiawei5@huawei.com> Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
326 lines
28 KiB
HTML
326 lines
28 KiB
HTML
<a name="EN-US_TOPIC_0125560321"></a><a name="EN-US_TOPIC_0125560321"></a>
|
|
|
|
<h1 class="topictitle1">PUT Bucket website</h1>
|
|
<div id="body25265097"><p id="EN-US_TOPIC_0125560321__p550816511194">You can use this operation to create or update the website configuration of a bucket.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p22672102">OBS allows you to store static web page resources such as HTML web pages, flash files, video files, and audio files to a bucket. When a client accesses these resources from the website endpoint of the bucket, the browser can directly resolve and present the resources to the client. This operation can be used to:</p>
|
|
<ul id="EN-US_TOPIC_0125560321__ul2722332"><li id="EN-US_TOPIC_0125560321__li26059286">Redirect all requests to a website endpoint.</li><li id="EN-US_TOPIC_0125560321__li33206990">Add routing rules that redirect specific requests.</li></ul>
|
|
<p id="EN-US_TOPIC_0125560321__p19182316">Only users granted the <strong id="EN-US_TOPIC_0125560321__b10621935857">s3:PutBucketWebsite</strong> permission can set the bucket website configuration. By default, only the bucket owner can set the bucket website configuration. The bucket owner can allow other users to set the bucket website configuration by granting them the permission. After the bucket website configuration is set, it will take effect within two minutes.</p>
|
|
<div class="note" id="EN-US_TOPIC_0125560321__note49724760"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0125560321__p48791549155811">Avoid using periods (.) in the target bucket name. Otherwise, the client may fail to authenticate the certificate when you use HTTPS for access.</p>
|
|
</div></div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section8461910"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560321__screen1140300712652"> PUT /?website HTTP/1.1
|
|
User-Agent: agent
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Content-Length: length
|
|
Date: date
|
|
Authorization: authorization
|
|
Expect: expect
|
|
|
|
<WebsiteConfiguration>
|
|
<RedirectAllRequestsTo>
|
|
<HostName>hostName</HostName>
|
|
</RedirectAllRequestsTo>
|
|
</WebsiteConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section9048327"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0125560321__p17213155120552">This request involves no parameters.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section14326087"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560321__p46110007">This request uses common headers. For details about common request headers, see section <a href="en-us_topic_0125560462.html">Common Request Headers</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section73133455518"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560321__p1003178">This request contains elements to specify the website configuration in the XML format. The elements differ for situations where users want to redirect all requests to a website endpoint and for when users want to add routing rules that redirect specific requests.</p>
|
|
<ul id="EN-US_TOPIC_0125560321__ul9028608"><li id="EN-US_TOPIC_0125560321__li14148614">To redirect all websites requests sent to the bucket's website endpoint, add the elements as described in <a href="#EN-US_TOPIC_0125560321__table5411655">Table 1</a>.</li></ul>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560321__table5411655"></a><a name="table5411655"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560321__table5411655" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Elements for redirecting all website requests</caption><thead align="left"><tr id="EN-US_TOPIC_0125560321__row20599592"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.4.2.4.1.1"><p id="EN-US_TOPIC_0125560321__p57954280">Element</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.4.2.4.1.2"><p id="EN-US_TOPIC_0125560321__p63785121">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.4.2.4.1.3"><p id="EN-US_TOPIC_0125560321__p66321146">Remarks</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0125560321__row3303707"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p66273709">WebsiteConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p66570199">Indicates the root element for the website configuration.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p62260885">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p23477058">Ancestor: None</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p22593558">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row2015430"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p29032137">RedirectAllRequestsTo</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p2792905">Describes the redirection behavior for every request to this bucket's website endpoint. If this element is present, no other siblings are allowed.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p25136147">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p24898733">Ancestor: WebsiteConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p3531486">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row31783374"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p24316508">HostName</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p23480171">Indicates the name of the host where requests will be redirected.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p9994955">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p22845731">Ancestor: RedirectAllRequestsTo</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p38564907">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row11539844"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p62312200">Protocol</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p14123440">Indicates the protocol (HTTP and HTTPS) used in redirecting requests. The default protocol is HTTP.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p60002101">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p3148005">Ancestor: RedirectAllRequestsTo</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p53661838">Optional</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<ul id="EN-US_TOPIC_0125560321__ul51641620"><li id="EN-US_TOPIC_0125560321__table103466791621">To add routing rules that describe conditions for redirecting requests, add the elements as described in <a href="#EN-US_TOPIC_0125560321__table48704899">Table 2</a>.</li></ul>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560321__table48704899"></a><a name="table48704899"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560321__table48704899" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Elements for adding rules that redirect requests</caption><thead align="left"><tr id="EN-US_TOPIC_0125560321__row16114131"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.6.2.4.1.1"><p id="EN-US_TOPIC_0125560321__p30176268">Element</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.6.2.4.1.2"><p id="EN-US_TOPIC_0125560321__p28358649">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.6.2.4.1.3"><p id="EN-US_TOPIC_0125560321__p15349251">Remarks</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0125560321__row35329809"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p43142284">WebsiteConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p4864091">Indicates the root element for the website configuration.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p43776822">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p58447079">Ancestor: None</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p36592919">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row60900816"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p34019058">IndexDocument</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p4080300">Indicates the container for the <strong id="EN-US_TOPIC_0125560321__b36722706">Suffix</strong> element.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p62068903">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p21749220">Ancestor: WebsiteConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p16856419">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row17490046"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p7407659">Suffix</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p63149496">Indicates a suffix that is appended to a request initiated for a directory on the website endpoint. For example, if the suffix is <strong id="EN-US_TOPIC_0125560321__b71710451350">index.html</strong> and you request for <strong id="EN-US_TOPIC_0125560321__b14835533">samplebucket/images/</strong>, the data that is returned will be for the object with the key name <strong id="EN-US_TOPIC_0125560321__b66410939">images/index.html</strong> in the <strong id="EN-US_TOPIC_0125560321__b60827539">samplebucket</strong> bucket. The suffix cannot be empty or contain slashes (/).</p>
|
|
<p id="EN-US_TOPIC_0125560321__p10576944">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p28083633">Ancestor: IndexDocument</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p60181840">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row4765656"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p50473818">ErrorDocument</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p61847473">Indicates the container for the <strong id="EN-US_TOPIC_0125560321__b19756352">Key</strong> element.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p43589445">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p56760689">Ancestor: WebsiteConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p34213098">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row39482434"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p43960571">key</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p4036497">Indicates the object key that is used when a 4<em id="EN-US_TOPIC_0125560321__i06861825202213">xx</em> error occurs. This element identifies the page that is returned when a 4<em id="EN-US_TOPIC_0125560321__i15591522122218">xx</em> error occurs.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p36328474">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p58520811">Ancestor: ErrorDocument</p>
|
|
<p id="EN-US_TOPIC_0125560321__p56925253">Condition: Required when <strong id="EN-US_TOPIC_0125560321__b149203537520">ErrorDocument</strong> is specified.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p25231885">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row25760373"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p6215498">RoutingRules</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p33693352">Indicates the container for the <strong id="EN-US_TOPIC_0125560321__b34804713">RoutingRule</strong> element.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p44806966">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p609510">Ancestor: WebsiteConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p49370368">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row41680131"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p20647442">RoutingRule</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p61830130">Indicates the container for a routing rule that identifies a condition and a redirect applicable when the condition is met.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p19600264">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p42184651">Ancestor: RoutingRules</p>
|
|
<p id="EN-US_TOPIC_0125560321__p44117540">Condition: In a <strong id="EN-US_TOPIC_0125560321__b61513540">RoutingRules</strong> container, there must be at least one <strong id="EN-US_TOPIC_0125560321__b16750948">RoutingRule</strong> element.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p14649520">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row64736823"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p9191297">Condition</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p6297612">Indicates the container for describing a condition that must be met for the specified redirect to apply.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p56678513">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p40344576">Ancestor: RoutingRule</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p46685187">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row17513507"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p9307971">KeyPrefixEquals</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p15748167">Indicates the object key name prefix when the redirection is applied.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p7515778">For example:</p>
|
|
<ul id="EN-US_TOPIC_0125560321__ul533144"><li id="EN-US_TOPIC_0125560321__li4798296">To redirect the request for object <strong id="EN-US_TOPIC_0125560321__b43184669">ExamplePage.html</strong>, the key prefix is set to <strong id="EN-US_TOPIC_0125560321__b53117702">ExamplePage.html</strong>.</li></ul>
|
|
<p id="EN-US_TOPIC_0125560321__p8297278">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p7566645">Ancestor: Condition</p>
|
|
<p id="EN-US_TOPIC_0125560321__p990949">Condition: Required when the parent element <strong id="EN-US_TOPIC_0125560321__b8918541">HttpErrorCodeReturnedEquals</strong> is not specified. If two conditions are specified, both conditions must be true for the redirection to be applied.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p51313205">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row59165662"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p27689346">HttpErrorCodeReturnedEquals</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p28244554">Indicates the HTTP error code returned when the redirection is applied. The specified redirect is applied only when the error code returned equals to this value.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p52874399">For example:</p>
|
|
<ul id="EN-US_TOPIC_0125560321__ul6107551"><li id="EN-US_TOPIC_0125560321__li54967961">If you want to redirect to <strong id="EN-US_TOPIC_0125560321__b24949608">NotFound.html</strong> when HTTP error code <strong id="EN-US_TOPIC_0125560321__b23219884">404</strong> is returned, set <strong id="EN-US_TOPIC_0125560321__b7652366">HttpErrorCodeReturnedEquals</strong> to <strong id="EN-US_TOPIC_0125560321__b1762431">404</strong> in <strong id="EN-US_TOPIC_0125560321__b15861880">Condition</strong> and <strong id="EN-US_TOPIC_0125560321__b8539194">ReplaceKeyWith</strong> to <strong id="EN-US_TOPIC_0125560321__b9743886">NotFound.html</strong> in <strong id="EN-US_TOPIC_0125560321__b20586118">Redirect</strong>.</li></ul>
|
|
<p id="EN-US_TOPIC_0125560321__p51057338">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p56862858">Ancestor: Condition</p>
|
|
<p id="EN-US_TOPIC_0125560321__p42003681">Condition: Required when parent element <strong id="EN-US_TOPIC_0125560321__b415387368">Condition</strong> is specified and sibling <strong id="EN-US_TOPIC_0125560321__b46855021">KeyPrefixEquals</strong> is not specified. If multiple conditions are specified, the redirection takes effect only after all conditions are met.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p37160390">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row66008059"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p45052529">Redirect</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p25376232">Indicates the container for redirect information. You can redirect requests to another host, to another web page, or with another protocol. You can specify an error code to be returned after an error.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p27059499">Type: Container</p>
|
|
<p id="EN-US_TOPIC_0125560321__p42208903">Ancestor: RoutingRule</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p63478007">Mandatory</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row34431157"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p37460321">Protocol</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p14387121">Indicates the protocol used in the redirection request.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p62375226">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p24506125">Ancestor: Redirect</p>
|
|
<p id="EN-US_TOPIC_0125560321__p19228540">Valid Values: http, https</p>
|
|
<p id="EN-US_TOPIC_0125560321__p38839134">Condition: Not required if one of the siblings is present.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p58962188">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row60897649"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p33762549">HostName</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p50411912">Indicates the host name used in the redirection request.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p51054032">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p56833109">Ancestor: Redirect</p>
|
|
<p id="EN-US_TOPIC_0125560321__p41735936">Condition: Not required if one of the siblings is present.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p25167636">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row25182135"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p26487069">ReplaceKeyPrefixWith</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p65077851">Indicates the object key prefix used in the redirection request.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p48829755">For example:</p>
|
|
<ul id="EN-US_TOPIC_0125560321__ul36814618"><li id="EN-US_TOPIC_0125560321__li62896114">To redirect all requests for (objects under) <strong id="EN-US_TOPIC_0125560321__b29194114">docs</strong> to (objects under) <strong id="EN-US_TOPIC_0125560321__b61420436">documents</strong>, set <strong id="EN-US_TOPIC_0125560321__b15913018">KeyPrefixEquals</strong> to <strong id="EN-US_TOPIC_0125560321__b8999435">docs</strong> in <strong id="EN-US_TOPIC_0125560321__b13886058">Condition</strong> and <strong id="EN-US_TOPIC_0125560321__b57865663">ReplaceKeyPrefixWith</strong> to <strong id="EN-US_TOPIC_0125560321__b51028923">documents</strong> in <strong id="EN-US_TOPIC_0125560321__b56607127">Redirect</strong>.</li></ul>
|
|
<p id="EN-US_TOPIC_0125560321__p39702100">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p21774588">Ancestor: Redirect</p>
|
|
<p id="EN-US_TOPIC_0125560321__p61753566">Condition: Not required if one of the siblings is present. Can be present only if <strong id="EN-US_TOPIC_0125560321__b18911189">ReplaceKeyWith</strong> is not provided.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p28940004">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row59133445"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p25079723">ReplaceKeyWith</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p18191719">Indicates the object key used in the redirection request. For example, redirect requests to <strong id="EN-US_TOPIC_0125560321__b29507743">error.html</strong>.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p64243102">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p41317012">Ancestor: Redirect</p>
|
|
<p id="EN-US_TOPIC_0125560321__p36308794">Condition: Not required if one of the siblings is present. Can be present only if <strong id="EN-US_TOPIC_0125560321__b58343698">ReplaceKeyPrefixWith</strong>is not provided.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p52645056">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560321__row4043462"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0125560321__p59085005">HttpRedirectCode</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0125560321__p21156092">Indicates the HTTP status code returned after the redirection request.</p>
|
|
<p id="EN-US_TOPIC_0125560321__p56187107">Type: String</p>
|
|
<p id="EN-US_TOPIC_0125560321__p35921916">Ancestor: Redirect</p>
|
|
<p id="EN-US_TOPIC_0125560321__p54861794">Condition: Not required if one of the siblings is present.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0125560321__p14620318">Optional</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section45559064"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560321__screen817125212714">HTTP/1.1 status_code
|
|
Server: Server Name
|
|
x-amz-request-id: request id
|
|
x-amz-id-2: id
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
Date: date
|
|
Content-Length: length </pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section7378398"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560321__p35356632">This response uses common headers. For details about common response headers, see section <a href="en-us_topic_0125560484.html">Common Response Headers</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section66405588"><h4 class="sectiontitle">Response Elements</h4><p id="EN-US_TOPIC_0125560321__p46628683">This response involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section60779388"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560321__p18826965">No special error responses are returned. For details about error responses, see <a href="en-us_topic_0125560440.html#EN-US_TOPIC_0125560440__table30733758">Table 1</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section25151514"><h4 class="sectiontitle">Example 1: Setting Website to Redirect All Requests</h4><pre class="screen" id="EN-US_TOPIC_0125560321__screen6410246912731">PUT /?website HTTP/1.1
|
|
User-Agent: curl/7.29.0
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: Sat, 04 Jan 2014 06:22:20 +0000
|
|
Authorization: AWS C6630CD15B645CB8A3BA:NiQpK7VHqCx93B8k14LJMSZy8ng=
|
|
Content-Length: 198
|
|
Expect: 100-continue
|
|
|
|
<WebsiteConfiguration>
|
|
<RedirectAllRequestsTo>
|
|
<HostName>www.example.com</HostName>
|
|
</RedirectAllRequestsTo>
|
|
</WebsiteConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section25037038"><h4 class="sectiontitle">Example 2: Setting Website to Add Routing Rules that Redirect Requests</h4><pre class="screen" id="EN-US_TOPIC_0125560321__screen137903012744">PUT /?website HTTP/1.1
|
|
User-Agent: curl/7.29.0
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: Sat, 04 Jan 2014 06:22:20 +0000
|
|
Authorization: AWS C6630CD15B645CB8A3BA:NiQpK7VHqCx93B8k14LJMSZy8ng=
|
|
Content-Length: 490
|
|
Expect: 100-continue
|
|
|
|
<WebsiteConfiguration>
|
|
<IndexDocument>
|
|
<Suffix>index.html</Suffix>
|
|
</IndexDocument>
|
|
<ErrorDocument>
|
|
<Key>Error.html</Key>
|
|
</ErrorDocument>
|
|
<RoutingRules>
|
|
<RoutingRule>
|
|
<Condition>
|
|
<KeyPrefixEquals>docs/</KeyPrefixEquals>
|
|
</Condition>
|
|
<Redirect>
|
|
<ReplaceKeyPrefixWith>documents/</ReplaceKeyPrefixWith>
|
|
</Redirect>
|
|
</RoutingRule>
|
|
</RoutingRules>
|
|
</WebsiteConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560321__section24006753"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560321__screen3435319012753">HTTP/1.1 200 OK
|
|
Date: Sat, 04 Jan 2014 06:24:31 GMT
|
|
Server: OBS
|
|
x-amz-request-id: 90E2BA0A420C00000140ED7A369007A2
|
|
x-amz-id-2: t35S98JCFKUMswCPZCk+UTi/VOoiSenzi5J6wnoKCIMfXUsKYGgU5+daiWAYiY/8
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
Content-Type: text/xml
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0125560493.html">Operations on Buckets</a></div>
|
|
</div>
|
|
</div>
|
|
|