0

Because I don't want to use CDN anymore I would like to rewrite cdn.example.com to www.example.com. How to do this with Nginx? There is only www.example.com in my server block.

1 Answers1

0
server {
    server_name cdn.example.com;
    return 301 $scheme://www.example.com$request_uri;
}

This assumes two things:

  • That cdn.example.com DNS is pointed at the same place www.example.com
  • That content served from CDN is being hosted on www under the same paths
sesser
  • 101
  • 1