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.Summarize and Research with AIShare on Social Media Related Articles How to Upload Large Files Without FTP Timeouts eCommerce – Setup your Merchant Account Gateway How to Zip and Unzip Files on Windows 11 and Windows 10 How to Transfer and Backup Website Files with Rsync .htaccess File Reference List: Rules, Fixes, and Uses How to Force a File Download With .htaccess Redirecting Visitors to an Under Construction Page How to Force www and non-www on Your Domain with .htaccess How to Use the .htaccess File Domain Resolves to Server Default Page