India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Canada English
Canada Français
Somalia English
Netherlands Nederlands

How to Redirect HTTP to HTTPS in cPanel

Wondering how to redirect HTTP to HTTPS in cPanel?

It’s essential for keeping your website secure in today’s digital world.

How to Redirect HTTP to HTTPS in cPanel

With cyber threats on the rise, understanding the difference between HTTP and HTTPS is crucial.

HTTP (HyperText Transfer Protocol) sends data in plain text, which can be intercepted.

On the other hand, HTTPS (HyperText Transfer Protocol Secure) encrypts data, providing a secure connection that enhances user trust and protects sensitive information.

In this guide, we’ll walk you through the steps to set up a redirect from HTTP to HTTPS using cPanel.

By doing this, your website will meet modern security standards and build confidence with your visitors.

We’ll cover the process, the benefits of switching to HTTPS, and how to maintain a secure online presence.

Why Redirect HTTP to HTTPS?

Redirecting HTTP to HTTPS is a smart move for several key reasons: it boosts security, helps with search engine ranking, and builds trust with your visitors.

Let’s break it down:

Enhanced Security

Switching to HTTPS is all about keeping your data safe.

HTTPS encrypts the information sent between your browser and the web server, making it much harder for hackers to intercept and steal sensitive details like passwords and credit card numbers.

This extra layer of protection helps guard against attacks where someone tries to snoop on your communications.

SEO Benefits

Google has been clear that HTTPS matters for search rankings.

Since 2014, Google has given a boost in search results to sites that use HTTPS.

This means if your website is secure, it’s more likely to show up higher in search results, which can drive more visitors to your site.

Trust and Credibility

You might have noticed the little padlock icon in the browser’s address bar when you visit a secure site.

How to Redirect HTTP to HTTPS in cPanel

This icon is a sign that the site is trustworthy.

Users are more comfortable entering their personal information on a site that shows it’s secure.

For e-commerce sites or any site dealing with sensitive data, HTTPS can help build credibility and make visitors feel safe.

Preparing for the Redirect

Want to switch your website from HTTP to HTTPS? Great choice for boosting security!

Before diving in, make sure your site has an SSL certificate.

It’s a must-have for creating a secure connection between your server and your visitors.

Ensuring SSL Certificate is Installed

An SSL certificate is like a digital ID card for your website.

It keeps your information safe by encrypting it and proving that your site is genuine.

Even though SSL has evolved into TLS (Transport Layer Security), we still call it SSL. Here’s why having this certificate is so important:

Data Encryption: SSL/TLS keeps data between the user’s browser and your server secure, making sure no one can steal sensitive info.

Authentication: It confirms that your site is legit, so attackers can’t create fake versions of your site.

Compliance: Some rules and standards require HTTPS for sites dealing with personal or sensitive data.

Without an SSL certificate, you can’t redirect HTTP to HTTPS, as there’s no secure connection to establish.

Checking SSL Installation in cPanel

To see if your SSL certificate is set up right in cPanel, follow these steps:

Log into cPanel: Go to your web hosting provider’s site and log into your cPanel account.

Find the SSL/TLS Section: In the cPanel dashboard, scroll down to the “Security” section and click “SSL/TLS.”

Manage SSL Sites: Click on “Manage SSL Sites” under the “SSL/TLS” section.

SSL/TLS SECTION

This takes you to a page where you can check your SSL certificates.

Check Installed Certificates: You’ll see a list of your domains with their SSL certificates.

Look for your domain name and check the status:

If it’s installed correctly, you’ll see a confirmation message that the SSL certificate is active.

If there’s no certificate listed or it shows an error, you’ll need to install or renew it.

For extra peace of mind, you can also use online SSL checker tools (like SSL Labs or Why No Padlock) to double-check that your SSL certificate is working properly.

Redirecting HTTP to HTTPS via cPanel

Here’s a quick guide:

Using the .htaccess File

If you don’t see a “Force HTTPS Redirect” option in cPanel, you can manually set up the redirect with the .htaccess file.

Locating the .htaccess File

Log into cPanel and open the File Manager.

Go to your website’s root directory, usually the “public_html” folder.

If you don’t see the .htaccess file, click “Settings” in the top right and check “Show hidden files (dotfiles).”

How to Redirect HTTP to HTTPS in cPanel

If the file isn’t there, create a new one named “.htaccess”.

Editing the .htaccess File

Right-click the .htaccess file and choose “Edit.”

Add this code:

RewriteEngine On

RewriteCond %{HTTPS} off

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

Save your changes.

Code Explanation

RewriteEngine On turns on the rewrite engine.

RewriteCond %{HTTPS} off checks if the request is using HTTP.

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] redirects HTTP requests to HTTPS permanently.

Using cPanel Redirects Tool

You can also use the Redirects tool in cPanel:

Accessing the Redirects Tool

Log into cPanel.

Go to the “Redirects” section under “Domains.”

Setting Up the Redirect

Select “Permanent (301)” from the dropdown menu.

Choose the domain you want to redirect.

Leave the URL path blank to redirect the entire domain.

Enter your HTTPS URL in the “Redirects to” field, like https://www.yourdomain.com.

Choose whether to redirect with or without “www.”

Optional: Check “Wild Card Redirect” to redirect all files.

Click “Add” to create the redirect.

Force HTTPS Redirect (Optional)

If your cPanel offers the “Force HTTPS Redirect” feature, you can use it for an easy setup:

Enabling Force HTTPS Redirect

Log into cPanel.

Go to the “Domains” section.

Find the “Force HTTPS Redirect” option for your domain.

ENABLE HTTPS REDIRECT

Toggle the redirect to “On” and confirm the change.

Check your site to make sure it redirects from HTTP to HTTPS.

Additional Notes

This feature needs a valid SSL certificate. If it’s not available, check your SSL setup.

You can enable or disable this redirect for multiple domains at once using the checkboxes.

Now your website should always use HTTPS, improving security and trust.

Testing the Redirect

So, you’ve set up a redirect from HTTP to HTTPS—great job! Now, you need to make sure it’s actually working. Here’s a simple way to test it:

Clear Your Cache

Before you start testing, clear your browser cache.

Sometimes, your browser might still show the old HTTP version of your site even after you’ve set up the redirect. Here’s how to clear your cache:

Open your web browser and press Ctrl + Shift + Del (Windows) or Command + Shift + Del (Mac).

Choose how far back you want to clear (e.g., last hour, last day, or all time).

Check the “Cached images and files” box and click “Clear data” or “Clear browsing data.”

Check the Redirect

Once your cache is cleared, you can check if the redirect is working:

Visit Your Site: Go to http://yourdomain.com in your browser. It should automatically switch to the HTTPS version.

Use Browser Tools: Open your browser’s developer tools (usually by pressing F12 or right-clicking and selecting “Inspect”) and go to the “Network” tab.

Reload the page and look for the HTTP request. It should show a 301 status code, which means the redirect is working properly.

Try Online Tools: Use online redirect checkers to see if everything is set up correctly. Some useful ones include:

Redirect Checker: Go to redirect-checker.org, enter your domain, and check the results.

Redirect Detective: Visit redirectdetective.com, enter your domain, and see the summary of the redirect.

Watch for Mixed Content

After the redirect, make sure your site doesn’t have mixed content issues.

Mixed content happens when an HTTPS page tries to load HTTP resources like images or scripts.

This can cause security warnings. Use your browser’s developer tools to spot and fix any mixed content problems.

Common Issues and Troubleshooting

When you’re redirecting from HTTP to HTTPS, you might run into some common issues.

Don’t worry—understanding these problems and knowing how to fix them will help make the switch smoother.

Mixed Content Errors

Sometimes, your secure HTTPS page might try to load something, like images or scripts, over an insecure HTTP connection.

When this happens, your browser might show a “Not Secure” message.

How to Fix Mixed Content Issues:

Identify Mixed Content: Open your browser’s developer tools (hit F12) and check the “Console” tab for warnings.

The “Network” tab will also show you which resources are still using HTTP.

Update Resource URLs: Change the URLs of any affected resources from HTTP to HTTPS.

Depending on your website’s setup (like WordPress or Joomla), you may need to edit the code or settings.

Use Relative URLs: Try using relative URLs (e.g., /images/photo.jpg) instead of absolute URLs (e.g., http://yourdomain.com/images/photo.jpg).

This way, the browser will use the right protocol automatically.

Utilize Plugins: If you’re using a CMS like WordPress, there are plugins available that can help fix mixed content issues automatically.

Redirect Loops

A redirect loop happens when a URL keeps redirecting to itself, creating an endless loop. This is often caused by conflicting redirect rules.

How to Resolve Redirect Loop Errors:

Check .htaccess File: Look at your .htaccess file for conflicting rules.

Make sure there’s only one set of redirect rules for HTTP to HTTPS.

Disable Other Redirects: Temporarily turn off any other redirects you’ve set up in cPanel or through plugins to find the source of the loop.

Test Incrementally: After making changes, test the redirect to see if the problem is fixed. This helps pinpoint the issue.

SSL Certificate Expiration

SSL certificates don’t last forever—they usually expire after 90 days to two years. If yours expires, users won’t be able to access your site securely.

How to Avoid Redirect Issues:

Set Reminders: Set up reminders or use monitoring tools to alert you a few weeks before your SSL certificate expires.

Automate Renewal: Some hosting providers offer automated SSL certificate renewal. Check with yours to see if they do.

Regularly Check SSL Status: Use online tools like SSL Labs or Why No Padlock to check if your SSL certificate is valid and properly installed.

Conclusion

Switching your website from HTTP to HTTPS is crucial for boosting your site’s security, improving its ranking on search engines, and earning your visitors’ trust.

By following the simple steps we’ve covered here, you can easily set up the redirect in cPanel using the .htaccess file or the Redirects tool.

But remember, you might run into issues like mixed content errors, redirect loops, or SSL certificate expiration.

Knowing about these problems and how to fix them will help you ensure a smooth and secure transition for your users.

In short, moving to HTTPS isn’t just about upgrading your site; it’s about showing your commitment to providing a safe and reliable online space.

Keep an eye on your site regularly to maintain this security and ensure your website stays protected in the long run.

Author

× WhatsApp us