skip to Main Content

I want to redirect http://cpanel.domain.com to https://cpanel.domain.com what can i do?

I tried this but its not working for cPanel it just working for domain.com :

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

2

Answers


  1. The code below is what you need for redirecting HTTP to HTTPS.

    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    
    Login or Signup to reply.
  2. add this code into .htaccess file


    RewriteEngine On

    RewriteCond %{SERVER_PORT} 80

    RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search