Redirecting www URLs to non-www

joomlaI haven't bothered to do this for websites for years, but recently I had to solve a problem with CiviCRM that required the URL to be a specific address. Apparently this configuration is also good for SEO. This article describes how to do it.


.htaccess

We will start by opening the .htaccess file for editing

  1. Browse to the root directory of your website.
  2. Open the .htaccess file and add the following content to the beginning of the file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301]

 

Thanks for visiting.