In administration panel go to Configuration => Configure modules
Select .htaccess file editing module
Redirections are used to select the domain for search engines. Remember that redirection works correctly only when your shop page shows up after typing the domain.
Add the request to the center of the file, if you want to display your site at http://shopexample.com
RewriteCond %{HTTP_HOST} ^www\.shopexample\.com [NC]
RewriteRule ^(.*)$ http://shopexample.com/$1 [L,R=301]
Add the request to the center of the file, if you want to display your site at http://www.shopexample.com
RewriteCond %{HTTP_HOST} ^shopexample.com [NC]
RewriteRule ^(.*)$ http://www.shopexample.com/$1 [L,R=301,NC]
Add the request to the center of the file, if you want to display your site at https://shopexample.com
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Add the request to the center of the file, if you want to display your site at https://www.shopexample.com
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]