Configure Rewrite to change and redirect the requests

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. 


How to set up Rewrite

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 and directory is /media/

Fill the Rewrite field with the following:

/(.*) /media/$1


  • /(.*) - the group of variables for which one Rewrite is applied. With this (.*) group Rewrite; will be applied for all of the possible variants which can appear after / in;
  • /media/ - directory, where CDN-servers will go for the content;
  • $1 - the number of the group of variables. If you have more than one group, the next numbers will be $2, $3 and so on.

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?
Recently viewed articles