Force non-www version for all sites on your account Scott MitchellUpdated on September 6, 2022 1 Minute Read When working with redirects in your htaccess, you are able to do specific things such as force a www or non-www version of your site. But since the .htaccess file is recursive, why not have some code that you can create once and have it work for all the sites on your account? This article demonstrates how you can force the non-www version of all sites on your account with a single piece of code. Don’t have time to read our full article? Watch our walk-through video. Force non-www on all sites on your account Log into your cPanel dashboard. Click on the File Manager icon located in the Files category, selecting the Web Root as the location. From the web root (public_html folder) open the .htaccess file for editing. If one does not exist, create a new one, then open the blank file for editing. Once the file is open, paste the following code at the top of the file: RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,QSA,NC,L] Save the changes to the file. Now you can test the code by visiting the www version of your site. It should redirect in the address bar to the non-www version.Share this Article Related Articles Intro to Migrating your WordPress Site Data Migrating your WordPress Database Migrating WordPress Files Configuring WordPress After a Migration Testing your WordPress website after Migration How to Move WordPress from a Subfolder to the Root Directory What to expect during a mass server migration Move Your WordPress Site to a New Server Moving Websites Built with Older Technology into WordPress How to Export Your WordPress Sites