The rewrite feature allows you to modify the Uniform Resource Identifiers (URIs) of requests by creating rewrite rules. After Dynamic Route for CDN (DCDN) receives a request, it matches the request against the rewrite rules. If a match is found, DCDN performs a 302 redirect to redirect the request to the specified target URI. You can create multiple rewrite rules as needed. This topic describes how to configure rewrite rules in the DCDN console.
If you need to modify the requested URI, create a rewrite rule. For example, if a
client requests to access
http://example.com over HTTP, you can create a rewrite rule to redirect all requests for
- Log on to the Dynamic Route for CDN console.
- In the left-side navigation pane, click Domain Names.
- On the Domain Names page, find the target domain name and click Configure.
- On the Rewrite tab, click Create.
- In the dialog box that appears, specify the original URI to be rewritten, the target
URI, and the rewrite flag.
The following redirect flags are available:
- Redirect: When the requested URI matches the current rule, DCDN returns a 302 status code and redirects the request to the target URI.
- Break: When the requested URI matches the current rule, DCDN returns the content of the target URI, and stops matching the requested URI against the remaining rules.
- Click OK.
After the rewrite rule is created, you can click Modify or Delete in the Actions column to modify or delete the rule.Note A domain supports up to 50 rewrite rules.
|Example||Requested URI||Target URI||Redirect flag||Description|
|Example 1||/hello||/index.html||Redirect||When a client requests the content of
|Example 2||^/hello$||/index.html||Break||When a client requests the content of
|Example 3||^/$||/index.html||Redirect||When a client requests the content of