Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  WordPress FAQ  >  How to Redirect HTTP to HTTPS in cPanel with Simple Steps?
Top Scroll

How to Redirect HTTP to HTTPS in cPanel with Simple Steps?

 4 min

HTTPS protocol represents secure communication over a computer network that is widely used on the Internet.

There are several WordPress users migrating from HTTP to HTTPS and the reasons are as below:

1. Google announced that HTTPS will be considered as a ranking factor in Google search.

2. The new HTTP/2 protocol helps in boosting the performance that needs HTTPS due to browser support. MilesWeb supports HTTP/2 on all servers.

3. HTTPS is considered to be highly secure and your visitor’s data stays completely encrypted.

4. It helps to build trust by enabling the green padlock in the visitor’s web browser address bar.

5. If someone visits a website from HTTPS and is going to an HTTP website, the referral data isn’t saved in Google Analytics. It usually gets combined together with the “direct traffic”. On the other hand, if someone goes from an HTTPS website to another HTTPS website, the referral data is saved. So, migrating from HTTP to HTTPS gives you more accurate referral data.

Redirect HTTP to HTTPS in cPanel with Redirects Tool

1. Log in to your cPanel account.

2. Go to the DOMAINS section and click Redirects.

3. Select the domain you want to redirect from the https?://(www.)? drop-down list.

4. In the Redirects to field, enter the complete URL of the page to which you want to redirect. Lastly, click the Add button.

A success message will flash on the screen, informing that the domain redirects to the target domain.

You will also find a few options when choosing to redirect HTTP to HTTPS in WordPress.

If you’re a MilesWeb client, you can either force HTTP to HTTPS via cPanel or by modifying the .htaccess file from the File Manager.

Redirect HTTP to HTTPS via cPanel without www

1. Log in to your cPanel account.

2. Click the File Manager in the Files section.

3. Browse Public_html and select the .htaccess file. Click on the Edit button.

4. A pop-up window will appear. Click on Edit.

5. Add the below code in the file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Once done, click on Save Changes.

Redirect HTTP to HTTPS via cPanel with www

Follow the above steps and, add the below code in the file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^milesweb.in [NC]
RewriteRule ^(.*)$ https://www.milesweb.in/$1 [L,R=301]

Once done, click on Save Changes.

Redirect HTTP to HTTPS Using .htaccess

Refer this guide for redirecting HTTP to HTTPS using .htaccess.

Redirect HTTP to HTTPS in Nginx

As per the W3Techs, Nginx is the fastest growing web server and holds more than 30%+ market share as of 2017.

Averagely, every minute one of the top 10 million websites starts to use Nginx.

In case your web server is running Nginx, it is possible to easily redirect all of your HTTP traffic to HTTPS. Simply add the following code to your Nginx config file. This method is recommended especially for redirecting WordPress running on Nginx.

server {
listen 80;
server_name domain.com www.domain.com;
return 301 https://domain.com$request_uri;
}

Redirect HTTP to HTTPS in Apache

In case your web server is running Apache, redirecting all of your HTTP traffic to HTTPS becomes very easy. For this, add the following code to your .htaccess file. This method is recommended for redirecting WordPress running on Apache.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect HTTP to HTTPS using Really Simple SSL Plugin

You can also redirect from HTTP to HTTPS by using the free WordPress Really Simple SSL plugin.

This method isn’t a permanent solution as 3rd party plugins can lead to other problems and compatibility issues.

Also, to migrate from HTTP to HTTPS, it is important to update your HTTP URLs in the database, instead of relying on a plugin. But this can be a good temporary solution.

It has been installed by more than 2 million times and has been given a 4.9 out of 5-star rating. You can download this plugin from the WordPress repository or by searching it within your WordPress dashboard under “Add New” plugins. The plugins do the below things:

  • It redirects all incoming HTTPS requests from HTTP to HTTPS. This is done either with .htaccess, or else with JavaScript.
  • Changes the WordPress site URL and home URL to HTTPS.
  • Fixes your insecure content by replacing all HTTP:// URLs with HTTPS://, except links to other external domains.

All this process is dynamic. Other than the WordPress site URL and home URL, no other database changes are made.

To use this plugin, you need to simply install and click on “Go ahead, activate SSL” and you’re good to go.

That’s all! This way you can now redirect HTTP to HTTPS in WordPress.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.