Learn how to enforce SSL/HTTPS redirection for your website using cPanel. Follow these steps to improve your website's security, boost SEO rankings, and leverage the performance benefits of HTTPS.
In today's digital world, website security is paramount. An SSL/TLS certificate encrypts communication between your website and visitors' browsers, ensuring data privacy. But what happens if some parts of your website still load over the unsecured HTTP protocol? This can create "mixed content" warnings, hurting your website's search engine ranking (SEO) and user experience. This guide will show you how to force HTTPS redirection using the cPanel interface, ensuring all traffic to your website is secure!
What is Mixed Content?
Imagine a website with a secure checkout page (HTTPS) but insecure images (HTTP). This creates "mixed content," where some elements are secure while others are not. Modern browsers display warnings for mixed content, raising red flags for visitors and search engines.
Why Force HTTPS Redirection?
There are several compelling reasons to force HTTPS redirection:
-
Enhanced Security: HTTPS encrypts all website traffic, protecting sensitive information like login credentials.
-
Improved SEO: Search engines like Google favor websites that use HTTPS. Forcing HTTPS redirection can give your website a ranking boost.
-
Increased Trust and Credibility: A secure website with HTTPS instills trust and confidence in visitors.
WebHostingM to the Rescue!
When you create a new account with WebHostingM, our system automatically installs an SSL/TLS certificate on your domain. However, some parts of your website might still be using HTTP. This guide will help you ensure all traffic is redirected to the secure HTTPS version.
Step-by-Step Guide:
1. Log in to cPanel:
- Access your cPanel hosting panel using your credentials.
2. Navigate to Domains Interface:
- Click on the "Domains" option in cPanel's navigation menu.
3. Enable Force HTTPS Redirection:
- Locate the option for "Force HTTPS Redirection" within the Domains interface.
- Toggle the switch to enable redirection from HTTP to HTTPS for all domains with valid SSL certificates.
4. Save Settings:
- Once you've enabled HTTPS redirection, the information will be stored in the account's userdata files.
- The redirection will be automatically configured in the domain's vhost configuration.
5. Inherit Redirection for Domain Aliases:
- Domain aliases, (also known as Parked Domains), will inherit the redirection status from their parent domain.
- No manual configuration or .htaccess redirects are required.
Using cPanel API
You can also use cPanel API to enable or disable secure redirects (HTTPS) for the cPanel account's domains that you specify.
Before you can do this, one of the following conditions must exist:
- AutoSSL must exist on the domains for which you enable secure redirects.
- A valid SSL certificate must exist for each domain for which you wish to enable secure redirects.
- You must own the domains for which you wish to enable secure redirects.
Let's first check whether the system can automatically redirect domains on a cPanel account to use SSL:
uapi --output=jsonpretty SSL can_ssl_redirect
Following that, let's proceed to enable or disable secure redirects (HTTPS):
uapi --output=jsonpretty SSL toggle_ssl_redirect_for_domains domains='main.example,addon.example,addon.main.example' state='1'
Verify Redirection
Test the redirection by accessing your website using the HTTP protocol (e.g. http://example_domain.com). You should automatically be redirected to the HTTPS version.
Conclusion:
Following these straightforward steps, you can enforce SSL/HTTPS redirection for your website in cPanel. This enhances security, improves SEO rankings, and leverages performance benefits. With cPanel's intuitive interface, you can easily toggle a switch to ensure visitors are directed to the secure version of your website.
WebHostingM Support Is Here to Help!
Remember: If you ever encounter issues or have questions specific to your WebHostingM account, or encounter any challenges that require assistance, simply submit a ticket and our friendly engineers will be happy to help you resolve any challenges you may face.
Not a WebHostingM customer yet, but curious about the power of cPanel? WebHostingM offers fantastic cPanel hosting plans – check them out at our cPanel Marketplace and unlock a world of website management possibilities!