This tutorial will provide you the best way to redirect users forcefully to https:// URL with www domain prefix. For example, your domain name is example.com, Below configuration will forcefully redirect users to https://www.example.com in all ways. Let’s edit Nginx virtual host configuration file: and add the below content. change example.com with your actual domain name. Also, add any other required settings specific for your Virtual host. After making the change to the configuration file, restart your Nginx web server and try to access your domain like URLs. In all the conditions, this will be redirected to https://www.example.com.