Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

HTTPS redirect .htaccess issue

Discussion in 'General Discussion' started by thehostingland, Jan 11, 2014.

  1. thehostingland

    Joined:
    Jan 5, 2012
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    53
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    I own multiple domain names under single main domain as addon domain .,
    i also bought ssl for main domain .
    to force all non ssl to ssl i use following .htaccess code

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^$ https://www.maindomain.com/$1 [R,L]

    this works fine ., but the issue is if i enter addondomain.info it also redirects to https://www.maindomain.com/addondomain.info/ .

    i want only main domain to do https redirection how to do it ???

    Note : if i enter www.addondomain.info instead of simply addondomain.info it works fine
     
  2. gopkris2005

    gopkris2005 Well-Known Member

    Joined:
    Jan 9, 2007
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    If possible, try this settings

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mydomain\.co.uk$ [NC]
    RewriteRule ^(.*)$ https://www.mydomain.co.uk/$1 [R=301,L]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. thehostingland

    Joined:
    Jan 5, 2012
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    53
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Tried mate., even this does the same old result no changes :(
     
  4. thehostingland

    Joined:
    Jan 5, 2012
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    53
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    I found the solution as follows :

    Add another condition to it:

    Also, you'll want to place this at the very top of your htaccess file so that it gets applied before any other rules.
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,468
    Likes Received:
    1,962
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    You may also want to consider installing separate SSL certificates for each addon domain name. It's possible to install multiple certificates for domain names on the same account and IP address assuming your system supports SNI (CentOS 6 or RHEL 6 and cPanel version 11.38 or higher).

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice