This EdgeRule is used to redirect mobile devices to mobile websites, in a Full Site Integration situation. Every request made to the internet will include a "User-Agent" header that identifies the device sending the request.
If you have not already, please check this guide to get started.
Creating the Rule
- Select the CDN Site you would like to create the rule for
- Navigate to your EdgeRules tab
- Select Add Custom Rule
- In the IF section, add a Header Regex Matches option to
/User-Agent: *(iPhone|Android).*/to catch mobile users.
- In the THEN section add a Redirect Rule with the value of
https://m.yourmobiledomain.com. Remember to replace m.yourmobiledomain.com with your actual mobile connection subdomain.
The Regex Matches option defined above will match any User-Agent Header that includes iPhone or Android and redirect to m.yourmobiledomain.com. It is important to keep in mind that this match is case-sensitive and will only work if the incoming User-Agent matches the casing as defined in the rule. Please remember to replace the redirect link with the actual domain you use for the mobile version of your website.
Verifying the Rule
This rule can be validated by a cURL command with the -H option applying a custom user-agent header to the request, triggering the rule as if it were a mobile user.
If you have any questions or would like any assistance setting up this rule, feel free to open up a chat with our 24/7 live support, we'll be happy to help you out.