set document root with htaccess

Discussion in 'Apache' started by bumbar, Dec 28, 2010.

  1. #1
    Hallo!

    I have the following problem with Symfony.
    I can not change the Root document for my web site, using CPanel.

    Site is (Basic, main domain) :confused:

    I created a folder mydomain.com (/home/xxxxx/public_html/mydomain.com)

    Document Root must be /home/xxxx/public_html/mydomain.com/web

    because I do not have permission to edit httpd.conf, I use .htaccess

    Here is /home/xxxxx/public_html/.htaccess

    Here is code:
    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
    RewriteCond %{REQUEST_URI} !^/mydomain.com/web/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /mydomain.com/web/$1
    RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
    RewriteRule ^(/)?$ /web/ [QSA,L]
    
    PHP:
    This work, and site loaded, but if write http://www.mydomain.com/index.php - crash,
    http://www.mydomain.com/frontend_dev.php - crash
    http://www.mydomain.com/backend_dev.php - crash

    Where is the error??
     
    bumbar, Dec 28, 2010 IP
  2. jarrodw

    jarrodw Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Since /web is your doc root try this:

    RewriteRule ^/$ /web/

    in your .htaccess
     
    jarrodw, Dec 29, 2010 IP