How to redirect http://domain.com to https://www.domain.com?

by alvera_smith , in category: SEO Tools , 4 months ago

How to redirect http://domain.com to https://www.domain.com?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by jose_gulgowski , 4 months ago

@alvera_smith 

To redirect "http://domain.com" to "https://www.domain.com," you can follow these steps:

  1. Login to your server or hosting account.
  2. Locate the ".htaccess" file in the root directory of your website. If you can't find it, create a new file with that name.
  3. Open the ".htaccess" file in a text editor.
  4. Add the following lines of code at the beginning of the file:
1
2
3
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]


  1. Save the changes to the ".htaccess" file.
  2. Test the redirection by accessing "http://domain.com" in a browser. It should automatically redirect to "https://www.domain.com."