Sometimes you want to force the use of WWW in front of your domain. There is generally very little difference on a site using a WWW prefix vs not using it. There are two reasons though why you might want to force it:
To force the use of WWW, just update your WordPress records on the WordPress settings screen.
You can confirm that the change has been made by going to the permalinks screen:
Click the SAVE CHANGES button to update your permalinks.
When you switch between HTTP and HTTPS (or vice-versa), we update the domain back to its default. So, you will need to make the change twice.
First, add the ‘www’ before turning on HTTPS. This allows us to get a certificate for both ‘www’ and non-www domains.
After HTTPS is turned on, go back and add ‘www’.
If you’re going from a “mydomain.com” to “www.mydomain.com” then you’ll want to use a WordPress search and replace tool to conduct two search & replaces on your database:
Do NOT search for just “mydomain.com” and replace with “www.mydomain.com”. If you do you might end up with entries such as “http://www.www.mydomain.com”.
We use the search and replace tool in UPDRAFT PLUS (which is our backup plugin). There are other tools that can be used to do this as well.
Don’t forget to set up your CNAME for the “www” prefix in your dns if it’s not already present!