Rewrite option is useful for changing or redirecting query paths. The option works accordingly to nginx configuration.
To enable Rewrite click Add Option in "Content" section and choose Enable Rewrite. You also can set up Rewrite in the Rules section.
After the option activation, some default values are shown in Rewrite body field. Clear the field and enter two space-separated directives: a path the Rewrite option is applied to and a path to be used instead. Use regular expressions.
For example, you need to apply Rewrite to all the resource and make CDN-servers get the content from the certain directory on your origin. Let's say that origin is example.com and directory is /media/, to set up Rewrite fill the "Rewrite" field with the following:
where:
Break flag is applied to the option by default. It is not shown in the field. You may apply to the option any other ngnix flags via API documentation.
Was this article helpful?
Learn more about our next-gen CDN