htaccess

How to Redirect HTTP Traffic to HTTPS

How to Redirect HTTP Traffic to HTTPS

Learn how to automatically redirect all HTTP traffic to HTTPS to secure your website and improve user trust.

Why Redirect HTTP to HTTPS?

Redirecting HTTP to HTTPS ensures all traffic to your website is encrypted and secure. HTTPS enhances user trust, improves SEO rankings, and meets modern browser security requirements. This redirection ensures that visitors always access the secure version of your website.

Methods to Redirect HTTP to HTTPS

You can redirect HTTP traffic to HTTPS using one of the following methods, depending on your server setup:

1. Redirect HTTP to HTTPS via .htaccess (Apache Servers)

If your website is hosted on an Apache server, you can use the .htaccess file to configure the redirect:

  1. Log in to your cPanel account.
  2. Navigate to the File Manager and open the root directory of your website (usually public_html).
  3. Edit or create a file named .htaccess.
  4. Add the following lines to the file:
    
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
        
  5. Save the file and refresh your website to test the redirection.

2. Redirect HTTP to HTTPS via cPanel’s Redirects Feature

If you prefer not to edit files manually, you can use cPanel’s built-in Redirects tool:

  1. Log in to your cPanel account.
  2. Go to the Domains section and click on Redirects.
  3. In the Redirects interface:
    • Select Permanent (301) as the redirect type.
    • Choose your domain from the dropdown menu.
    • Enter https://yourdomain.com in the "Redirects to" field.
    • Click Add to save the redirect.
  4. Test the redirect by visiting http://yourdomain.com and confirming it redirects to https://yourdomain.com.

3. Redirect HTTP to HTTPS Using WordPress Plugins

If your website runs on WordPress, you can easily set up HTTPS redirection using plugins:

  1. Log in to your WordPress admin dashboard.
  2. Install and activate a plugin like Really Simple SSL.
  3. Follow the plugin setup wizard to enable HTTPS redirection automatically.

Note: Ensure you have an SSL certificate installed on your hosting account before enabling HTTPS.

Testing Your HTTPS Redirect

After setting up the redirect, verify it’s working properly:

  • Visit your website using http://. Ensure it redirects to https:// without errors.
  • Use online tools like Redirect Checker to confirm the redirect status.

Secure Hosting with UnderHost.com

At UnderHost.com, all our hosting plans include free SSL certificates with AutoSSL, making it easy to secure your website and redirect HTTP traffic to HTTPS. Explore our shared hosting, cloud VPS, or dedicated server solutions for reliable and secure hosting.

Need Assistance?

If you encounter issues or need help setting up HTTPS redirection, contact our support team at @CustomerPanel. We’re here to help you secure your website and enhance user trust.

Knowledgebase