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 Issue with Apache?

Discussion in 'EasyApache' started by msalmanzaib, Sep 1, 2015.

  1. msalmanzaib

    msalmanzaib Member

    Joined:
    Dec 20, 2013
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Im having issue with https when using Apache all website with ssl failed to load with error like this.

    - Removed -

    .htaccess code.

    Code:
        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
        RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    this htaccess code works fine when using Litespeed and also was working on same server before reinstall of OS.

    Cpanel Ticket was also submitted with no solution # 7037721

    Please suggest how to fix issue as i have to use Apache with nginx for better performance of my websites.
     

    Attached Files:

    #1 msalmanzaib, Sep 1, 2015
    Last edited: Sep 1, 2015
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,145
    Likes Received:
    34
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hello,

    Do you notice any specific error messages in Apache error logs file ? Can you please check it and post here so that we can assist you on this.
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,446
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    This was resolved in ticket #7037721 as being an .htaccess issue.
     
  4. msalmanzaib

    msalmanzaib Member

    Joined:
    Dec 20, 2013
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Its not an htaccess issue as this htaccess code works fine when using Litespeed and also was working on same server before reinstall of OS with Apache.
     
  5. hostCAPO

    hostCAPO Member

    Joined:
    Sep 2, 2015
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    1
    Location:
    Birmingham, AL
    cPanel Access Level:
    Root Administrator
    Hello,
    What are you using for NGINX? I know that apache .htaccess rules don't work with NGINX normally, though there are some reverse proxy plugins for WHM that do.

    Regards,
    Jeremy A.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you let us know the purpose of the rewrite rule so we can offer an alternative to the rule you are currently using?

    Thank you.
     
  7. msalmanzaib

    msalmanzaib Member

    Joined:
    Dec 20, 2013
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Following code is being used for www to non-www.
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    Code being used for http to https for all pages
    Code:
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    Removing http to https code it works fine but for best practices i need to redirect all pages to https if not then google will double index each page. Please suggest any alternative code. Its annoying situation as everything was working with Apache before server reinstall.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  9. msalmanzaib

    msalmanzaib Member

    Joined:
    Dec 20, 2013
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page