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.

subdomain point to wrong document root

Discussion in 'General Discussion' started by devGOD, Mar 16, 2006.

  1. devGOD

    devGOD Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    i have a sub.domain.com and when i do a check for the document root using $_SERVER['DOCUMENT_ROOT'] it shows up as /home/domain/public_html it should be /home/domain/public_html/sub

    how do i fix the error with the document root. by the way i've already checked httpd.conf and its set correctly in there, the doc root
     
  2. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    As a quick fix, how about using:
    Code:
    $_SERVER['DOCUMENT_ROOT'].'/sub';
     
  3. devGOD

    devGOD Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    tried it =/ the script i'm using has a DIR_ROOT define i tried changing it there with the example you gave, but apparently the script is calling the php $_SERVER['DOCUMENT_ROOT']. in other place, one being an encrypted license file.
     
  4. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    Try running the $_SERVER['DOCUMENT_ROOT'] script from www.sub.domain.com rather than sub.domain.com

    Does that display the correct doc root? If yes, then your httpd.conf probably looks like:
    Code:
    ServerAlias www.sub.domain.com
    Change it to:
    Code:
    ServerAlias www.sub.domain.com sub.domain.com
    Please post here if you fix the issue, since a bug report may be required...
     
    #4 adept2003, Mar 16, 2006
    Last edited: Mar 16, 2006
  5. weblord

    weblord Member

    Joined:
    Mar 16, 2006
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    dirty and quick fix, delete the subdomain and re-add it works for me every time
     
  6. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    That suggests that perhaps httpd needs to be restarted?
     
  7. weblord

    weblord Member

    Joined:
    Mar 16, 2006
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    named service may be restarted
     
  8. devGOD

    devGOD Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    tried everything suggested. let me post some more info about everything. (sorry if i repeat anything, just want to cover everything.)

    $_SERVER['DOCUMENT_ROOT'] for beta.domain.com should return /home/domain/public_html/beta but, it's returning /home/domain/public_html/

    httpd.conf

    subdomain beta.domain.com
    <VirtualHost #.#.#.#>
    ServerAlias www.beta.domain.com beta.domain.com
    ServerAdmin webmaster@beta.domain.com
    DocumentRoot /home/domain/public_html/beta
    BytesLog domlogs/beta.domain.com-bytes_log
    ServerName beta.domain.com

    User domain
    Group domain
    CustomLog /usr/local/apache/domlogs/beta.domain.com combined
    ScriptAlias /cgi-bin/ /home/domain/public_html/beta/cgi-bin/
    </VirtualHost>

    parent www.domain.com
    <VirtualHost #.#.#.#>
    ServerAlias www.domain.com domain.com
    ServerAdmin support@domain.com
    DocumentRoot /home/domain/public_html
    BytesLog domlogs/domain.com-bytes_log
    ServerName www.domain.com

    User domain
    Group domain
    CustomLog domlogs/domain.com combined
    ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/
    </VirtualHost>


    named file domain.com.db
    beta 14400 IN CNAME domain.com.


    htaccess in the parent root www.domain.com
    Options -Indexes
    Options +FollowSymLinks

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} beta.domain.com
    RewriteCond %{REQUEST_URI} !beta/
    RewriteRule ^(.*)$ beta/$1 [L]

    #this stuff is for another script...
    RewriteCond %{REQUEST_FILENAME} !-F
    RewriteCond %{REQUEST_FILENAME} !-D
    RewriteCond %{REQUEST_URI} !^ads/
    RewriteCond %{REQUEST_URI} !^shop/
    RewriteRule ^(.*) index.php [L]

    thats about everything. also i've tried removing the sub domain and reinstalling it. same results.
     
    #8 devGOD, Mar 16, 2006
    Last edited: Mar 16, 2006
  9. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    Who wrote this? It really doesn't look right at all. What happenes when you delete this part of the .htaccess?
     
  10. weblord

    weblord Member

    Joined:
    Mar 16, 2006
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    try removing the first line, i remember that line cause problem on pixads rewrite... on.
     
  11. devGOD

    devGOD Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    if i remove

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} beta.domain.com
    RewriteCond %{REQUEST_URI} !beta/
    RewriteRule ^(.*)$ beta/$1 [L]

    then beta.domain.com will show domain.com. the below part of the .htaccess is rewritting all urls

    RewriteCond %{REQUEST_FILENAME} !-F
    RewriteCond %{REQUEST_FILENAME} !-D
    RewriteCond %{REQUEST_URI} !^ads/
    RewriteCond %{REQUEST_URI} !^shop/
    RewriteRule ^(.*) index.php [L]
     
Loading...

Share This Page