In this section, you can learn how to direct traffic from a specific URL to another within the Page Rules area. To begin, navigate to the Page Rules section of your user panel under the VergeCloud CDN service and select the option to Add New Rule.
A practical example would be if your website has moved to a new domain and you want to ensure that visitors using the old URL are seamlessly redirected to the new address.
![Image Placeholder](image-placeholder.png)
![Image Placeholder](image-placeholder.png)
![Image Placeholder](image-placeholder.png)
Once you have selected your code, input the domain you wish to redirect from in the URL section and click on Create.
The basic Page Rules settings enable straightforward redirection. However, if the main domain has multiple source URLs, the redirection may not function correctly. For instance, if you are redirecting from:
Requests to sample.com/example.html will still redirect to newsample.com instead of the ideal newsample.com/example.html.
To address this, you need to employ variables within the page rule. Access the Page Rules section of your VergeCloud account under the CDN tab and select Add a New Rule.
![Image Placeholder](image-placeholder.png)
![Image Placeholder](image-placeholder.png)
Note: The query string will not be redirected between the source and destination URLs in the examples above.
![Image Placeholder](image-placeholder.png)
Additionally, a single address can accommodate multiple variables; for example, *.sample.com/*. Here, $1 refers to the first variable, $2 to the second, and $n to the nth variable.
Example: $1.newsample.com/$2
![Image Placeholder](image-placeholder.png)
Once you have configured all settings, click on Add a New Rule to save and apply the changes.
After configuring your redirect, to verify its functionality, you can open a browser and navigate to sample.com/example.html. You should be automatically redirected to newsample.com/example.html.