Please note if you have an SSL Certificate, it should be issued with the www subdomain to use this code. Also this blanket code that covers all directories in your website. If you have any subdomains created, you may have to add to this code, or create additional htaccess files in the subdomain directories to make them work.
Please open a support ticket if you need any additional help.