You can configure your website to automatically redirect its visitors to one central domain name. This is done with a few lines of code in an ".htaccess" file, file found in your "/var/www/html" (or your "mainwebsite_html") directory. If that file does not exist already, you can create a blank file and name it ".htaccess".
** Warning: modifying this .htaccess file can potentially bring your website down or cause unintended results. Be sure to back this file up before making any changes.
You will want to put in the following code (replacing "DOMAIN.COM" with your domain name):
#--- Start Redirect Code
RewriteEngine On
# Handles regular requests
RewriteCond %{HTTP_HOST} !^www.DOMAIN.COM$ [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ http://www.DOMAIN.COM/$1 [R=301,L]
# Handles SSL-page requests
RewriteCond %{HTTP_HOST} !^www.DOMAIN.COM$ [NC]
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https://www.DOMAIN.COM/$1 [R=301,L]
#---/End Redirect Code