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!

vhost include issues

Discussion in 'General Discussion' started by createanet, May 1, 2014.

  1. createanet

    createanet Registered

    Joined:
    Oct 15, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    Hi,

    I've been having some trouble with a custom config I am including in the httpd.conf.

    I was wanting to move a great deal of redirects from the websites .htaccess into the VirtualHost.

    Previously in the past this has worked, but for some reason not this time. Am I missing something?

    Code:
    $ vi /usr/local/apache/conf/userdata/std/2/xxx/xxxx.com/main.con
    For example...

    Code:
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{HTTP_HOST} !^www\.xxx\.com [NC]
      RewriteRule ^(.*)$ http://www.xxx.com/$1 [L,R=301]
    </IfModule>
    This is written to the file, then I run some checks before rebuilding the httpd.conf

    Code:
    $ /scripts/verify_vhost_includes
    This tells me it has found the new conf and has confirmed it is OK.

    Code:
    $ /usr/local/cpanel/bin/apache_conf_distiller --update --main
    Code:
    $ /usr/local/cpanel/bin/build_apache_conf
    Restart Apache

    When I check to see if this works, it fails? If I include it back into the .htaccess it works successfully.

    Thanks in advance.

    Mart
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,673
    Likes Received:
    1,788
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    Try using the specific version of Apache (e.g. 2.2, 2.4) to see if that makes a difference. EX:

    Code:
    /usr/local/apache/conf/userdata/std/2_2/$user/$domain/$includename.conf
    The full documentation is available here:

    Changes Contained Within a VirtualHost Directive

    Note it's not necessary to run the Apache distiller after editing VirtualHost include files.

    Thank you.
     
    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