I have redirected my site from http to https. I want to allow the useragent XYZ and XYZ whatever to enter both http and https versions.
Now the vhost looks like this:
server {
listen 80;
server_name example.com www.example.com;
rewrite ^/(.*)$ https://www.example.com/$1 permanent;
}
How can I edit it, in order to allow agents that contain XYZ to see both HTTP and HTTPS? In order words... how to disable the redirect for such agents?
I tried
if ($http_user_agent ~* "^XYZ$") {
rewrite ^/(.*)$ https://www.example.com/$1 permanent;
}
But this seems to redirect only XYZ. But I need to disable the redirect if XYZ, not strict XYZ, but containing XYZ...