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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    4
    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:
    4
    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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page