Add www to the Root Site in WP Multisite Network

I have a WordPress (Latest version) based website with Multisite Network Enabled. For example, the domain is example.com. So, my root site is example.com and my subsite is blog.example.com. But I want my root site as www.example.com. To do so, I’ve taken 4 steps:

Modified .htaccess file. Added the code below:

RewriteEngine on RewriteCond %{HTTP_HOST} !^www.example.com$   RewriteRule ^(.*)$   https://www.example.com/$  1 [R=301] 

Modified wp-config.php:

define('DOMAIN_CURRENT_SITE', 'www.example.com'); 

Modified MySQL table wp_site. Old data: domain: example.com. New Data:

domain: www.example.com 

Modified MySQL table wp_sitemeta. Old data: siteurl: example.com. New Data:

siteurl: www.example.com 

But unfortunately, it didn’t work. What to do? Thanks in advance.