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 to https URL redirection

Discussion in 'Workarounds and Optimization' started by triaxial, Nov 16, 2015.

  1. triaxial

    triaxial Registered

    Joined:
    Nov 16, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Australia
    cPanel Access Level:
    Reseller Owner
    Hi All,

    I have been an end user for Cpanel, now at the pointy end to get stuff done. Learning a lot from the forums (thanks).

    Question:
    I have a simple question on URL redirection. I need all sub domains without www which needs to be redirected for HTTPS only eg. when I goto https://a.com/abc/xyz.html, it should go to
    https://1.b.com/abc/xyz.html. This needs to be a temporary link only.

    when I goto https://www.a.com it should only goto https://www.a.com



    Things you need to know:
    1. I own https://a.com (with CA issued SSL cert installed and working standalone)
    2. I don't own https://1.b.com. This is hosted on a different server apart from a.com
    3. I have a reseller account only, so NO root access to server
    4. Underlying OS is CentOS I believe with litespeed & cpanel

    What I have tried so far:
    I tried a few options does not work. Tried via CPANEL redirection & .htaccess. This is the latest .htaccess entry I tried, still NO luck

    RewriteCond %{HTTP_HOST} ^a\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.a\.com$
    RewriteRule ^(.*)$ "https\:\/\/1\.b\.com\/$1" [R=302,L]


    Thanks in advance.
    triaxial
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. triaxial

    triaxial Registered

    Joined:
    Nov 16, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Australia
    cPanel Access Level:
    Reseller Owner
    Tried that it does not work.. The word press one exists, so

    Option 1 tried:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress


    RewriteEngine On
    RewriteCond %{HTTPS} ^a.com$
    RewriteRule ^(.*)$ "https\:\/\/1\.b\.com\/$1" [R=301,L]

    option 2 tried:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]


    RewriteCond %{HTTPS} ^a.com$
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ "https\:\/\/1\.b\.com\/$1" [R=301,L]
    </IfModule>

    # END WordPress
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You may receive more user-feedback for custom Mod_Rewrite rules on forums such as StackOverflow. Please update us on your findings after creating a new post there if the existing posts are unhelpful.

    Thank you.
     
Loading...

Share This Page