Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Default build_apache_conf groups all rewritecond and rewriterules together

    I have a sequence of rewrite rules in my httpd.conf as follows:

    RewriteCond Condition#1
    RewriteRule Rule#1
    RewriteCond Condition#2
    RewriteRule Rule#2

    However, whenever cpanel rebuilds the httpd.conf file, it groups all of the rewritecond and rewrite rules together, effectively breaking their functionality:

    RewriteCond Condition#1
    RewriteCond Condition#2
    RewriteRule Rule#1
    RewriteRule Rule#2

    Unless I'm overlooking something, this appears to be a MAJOR BUG. In my case, it's so bad that the rewrite rules create an infinite redirect and make the domain inaccessible until I correct the rewrite ordering.

    Please clarify if I am doing something wrong. For now I just avoid having cpanel rebuild the apache conf file, and just use the distiller followed by an httpd restart, but sometimes having cpanel rebuild the conf file is unavoidable, so I always have to keep a httpd.conf backup.

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: build_apache_conf groups all rewritecond and rewriterules together

    You would not add anything to httpd.conf directly. These should be done as includes instead.

    If you need them for the main configuration, then you can use /usr/local/apache/conf/includes area or WHM > Apache Configuration > Include Editor area.

    If these are for some select virtual host entries, then instead put them into /usr/local/apache/conf/userdata at the applicable location. Here's a discussion on using includes for the Virtual Host sections:

    Changes Contained within a VirtualHost Directive
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Default Re: build_apache_conf groups all rewritecond and rewriterules together

    So I would place all prior custom <Directory "PATH">xxxx</Directory> directives inside the pre_virtualhost_global.conf file? For some reason any changes in this file aren't getting incorporated into httpd.conf when running the two in sequence:

    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    Last edited by compuminus; 03-10-2011 at 05:40 PM.

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: build_apache_conf groups all rewritecond and rewriterules together

    Where in Apache do you normally put these includes? Do you really put them at the end of the Virtual Host section after all Virtual Host entries or do you normally put them before the Virtual Host entries? If you normally put them before those entries, you would want to use pre_main_global.conf and then rebuild Apache and restart Apache.

    Of note, you will *not* see the entries go into httpd.conf itself. The files are included, which means Apache reads any includes into the file. If you see post_virtualhost_global.conf as an include in httpd.conf file, then it is including the entries into the file and reading those entries.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Default Re: build_apache_conf groups all rewritecond and rewriterules together

    Thank you -- everything has now been sorted.

Similar Threads & Tags
Similar threads

  1. build_apache_conf -> Domain ownership conflict
    By thobarn in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 02-26-2009, 01:23 PM
  2. Two users Groups
    By lblanchardiii in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-29-2008, 04:17 AM
  3. apache_conf_distiller / build_apache_conf
    By jmcole in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-09-2007, 12:28 PM
  4. Users groups
    By wills in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-26-2004, 10:39 PM
  5. News groups
    By phantom in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-06-2003, 01:54 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube