Redirect HTTP to HTTPS and non www to www [Full Guide]
Index - Redirect HTTP to HTTPS and Non-www to www
Redirect HTTP to HTTPS is the most common question for all webmaster who configured SSL first time. After Configuring SSL, the next point is redirecting all visitors to secure website that is called HTTPS. Redirecting Traffic will not affect your website performance so it is safe and advisable to redirect your all traffic HTTP to HTTPS after configuring SSL.
On Recent Updates, All Major Browsers started showing a insecure Warning on sites that don't have SSL Certificates Installed. This will give bad impression to users because of insecure website. A SSL Configured website is more secure and 99% chances to prevent hacking.
Redirect HTTP to HTTPS using cPanel
This is the easy method to redirecting all traffic http to https. cPanel Redirection Option will give you the power of redirecting any page to another page. You can also redirect whole domain using cPanel but carefully add redirection. Here is some method to add redirection safely in Cpanel
STEP 1: Open Your hosting Control Panel or cPanel
STEP 2: Find "Redirect" Option or Goto Domain Manager (In Some Hosting)
STEP 3: Now, You can see Type, https?://(www.)?, Redirects to, www. redirection:
STEP 4: First is Type, It has two options Permanent (301) and Temporary (302). Select Permanent Option
STEP 5: Second Option is Domain, If you have multiple addon domain then carefully your select domain because we are going to add redirection in this domain.
STEP 6: Next is Redirect to, This is the destination where you want to redirect above domain to this domain. It must be a valid URL. Enter https://www.yourdomain.com or https://yourdomain.com to add https redirection.
STEP 7: The Last one www. redirection:, Choice is yours do you want to keep www or non www.
- Only redirect with www. will redirect whenever someone visit your domain with www. This option can be used when you don't want to kept www on your website. for example: www.yourdomain.com > yourdomain.com or https://www.yourdomain.com > https://yourdomain.com
- Redirect with or without www. This option can be used when you are redirecting whole domain to another domain. You must carefully manage what you want becuase this option will redirect your whole domain to another or it may cause redirection loop in some cases
- Do Not Redirect www. if this option is selected then your whole domain redirected to another domain expect www, In Simple words when a user visit www.yourdomain.com then redirection condition will not apply and this will be skipped, other side when a user visit yourdomain.com then redirection condition will match and applied.
- Wild Card Redirect will redirect all files within a directory to the same filename in the redirected directory. for example: www.yourdomain.com/page-title > www.newdomain.com/page-title or http://www.yourdomain.com > https://www.yourdomain.com
If you want to add www in your domain then select Do Not Redirect www.
If you want to remove www from your domain then select Only redirect with www.
If you want to redirect your whole domain and pages to another domain then select Redirect with or without www. and Check the Wild Card Redirect
STEP 8: Check the Wild Card Redirection
STEP 9: Final is, Click on Add button
STEP 10: On Successful redirection, A Message will be shown. If successful message not shown then there is a problem in redirection check the error message and try again.
How to Redirect HTTP to HTTPS with htaccess
Sometimes cPanel lacks to add redirection as we want or it will add a redirection loop if you are trying to add redirection for http to https.