Introduction
Sometimes you want to send visitors to different web pages based on conditions like the URL they requested. Nginx lets you do this using conditional redirects with the if directive. This helps control traffic flow on your website easily.
When you want to redirect users from an old page URL to a new one only if they visit the old URL.
When you want to send mobile users to a mobile version of your site based on their user agent.
When you want to block access to certain URLs and redirect those requests to a warning page.
When you want to redirect users to HTTPS only if they visit the site using HTTP.
When you want to redirect requests with specific query parameters to a special page.