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.

DOCUMENT_ROOT trailing slash

Discussion in 'General Discussion' started by muppsy007, Mar 18, 2009.

  1. muppsy007

    muppsy007 Member

    Joined:
    Dec 10, 2008
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi all,

    cPanel 11.24.4-R34599
    WHM 11.24.2 - X 3.9
    CENTOS 5.2 i686 on standard

    This is a new server setup and we have slight problem with what is returned from $_SERVER['DOCUMENT_ROOT'] in that on the above server, it is returned without a trailing slash.

    Our development server however does return it with a trailing slash. So this causes a little bit of havoc with config files when launching sites.

    Does anyone know if this is configurable and where? Preferably, I'd like to make the new cPanel server add the slash rather than make the development server omit it.

    Cheers
    Aaron
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    Check whatever the CanonicalName setting is for that virtualhost within the Apache config, and change it to the opposite. For instance, if it's on, change it to off.
     
  3. muppsy007

    muppsy007 Member

    Joined:
    Dec 10, 2008
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Hi Vanessa,

    Where would I find this CanonicalName? I can't see it in "Apache Configuration" or "EasyApache".

    Cheers
    Aaron
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,475
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  5. muppsy007

    muppsy007 Member

    Joined:
    Dec 10, 2008
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Thank you.

    I have looked in this conf file and found the CanonicalName directive for this virtual. It was set to 'Off'.

    I changed it to 'On', and restarted Apache. This made no difference at all.

    As a side note, I want the trailing slash to be present on all virtual hosts. We have some 60+ websites to migrate and modifying each virtual host is just the same as going into each site and adding a .'/' after $_SERVER['DOCUMENT_ROOT'].

    I'm a bit mystified why two different servers would treat this differently, and yet not have an easy way to change it.

    Cheers
    Aaron
     

Share This Page