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!

Making VirtualHost changes permanent

Discussion in 'EasyApache' started by SpaceCowboy, Feb 5, 2017.

  1. SpaceCowboy

    SpaceCowboy Well-Known Member

    Joined:
    Jan 18, 2014
    Messages:
    54
    Likes Received:
    5
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    Hi, i don't understand how these includes work.

    If i got it right any change made directly to httpd.conf they will be lost on /scripts/rebuildhttpdconf

    I am looking at this without understand how to actually do it.

    At the end of the virtualhost i'm trying to edit it says:
    # Include "/etc/apache2/conf.d/userdata/std/2_4/... <- This doesn't exist, and the include is a comment so... it won't pick it up even if create them.

    All i want to do is add this to one of the VirtualHost:
    Code:
            RewriteEngine On
            RewriteCond %{HTTPS} off
            RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC]
            RewriteRule (.*) https://domain.com%{REQUEST_URI} [END,QSA,R=permanent]
    1. Where should this file be placed?
    2. How should the file be called?
    3. What should the file contain? A copy of the virtualhost modified? The entire httpd.conf modified?
     
  2. SpaceCowboy

    SpaceCowboy Well-Known Member

    Joined:
    Jan 18, 2014
    Messages:
    54
    Likes Received:
    5
    Trophy Points:
    8
    cPanel Access Level:
    Website Owner
    Solved:
    1. Created /etc/apache2/conf.d/userdata/std/2_4/... directory.
    2. Created "ssl.conf" file with the code above inside directory
    3. Un-commented include line on httpd.conf ( Include "/etc/apache2/conf.d/...)
    4. Run /scripts/rebuildhttpdconf
     
    #2 SpaceCowboy, Feb 5, 2017
    Last edited: Feb 5, 2017
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,749
    Likes Received:
    1,884
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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