The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    3
    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:
    61
    Likes Received:
    0
    Trophy Points:
    6
    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]
     
  3. thehostingland

    Joined:
    Jan 5, 2012
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    3
    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:
    3
    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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,831
    Likes Received:
    672
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page