Configure URL redirects
You can configure URL redirects for your site that specifically relate to 301 and 302 browser response codes, indicating that your redirected URL has either permanently or temporarily moved, respectively.
This section applies to Open Storefront Framework (OSF) and Storefront Classic.
In the case of a 301 redirect, the URL is moved to a new target permanently. This type of redirection can help with moving the SEO authority from the old URL to the new equivalent. The following example illustrates a 301 redirect with an example site base URL: www.example-shop.com/example
with the redirection rule:
- originUrl:
/smartphones/collection/id1234?show=all
- targetUrl:
/fr/smartphones/collection/id789?show=20
URL redirects are created/deleted using the createRedirect
and deleteRedirect
endpoints in the Admin REST API. The total number of entries in the database defaults to 1 million. Should you require more than that, please contact Oracle Support.
siteId
is not provided, then the rule acts as a global redirect for all sites. The following table describes the properties for redirecting URLs:
Parameter | Description |
originUrl | Origin URL of the redirect. |
siteId | ID of the site to which the redirect belongs. |
type | Redirect type (301 or 302). |
targetUrl | Destination URL of the redirect. |
deleteRedirect
endpoint. For example: DELETE /ccadmin/v1/redirects/30001
.
The following example illustrates a 301 redirect:
POST /ccadmin/v1/redirects HTTP/1.1
Authorization: Bearer <access_token>
Content-Type: application/json
{
"originUrl": "/smartphones/collection/id1234?show=all",
"siteId": "siteUS",
"type": 301,
"targetUrl": "/fr/smartphones/collection/id789?show=20"
}
See the Oracle Commerce REST API documentation in the Oracle Help Center for more information.