Author Topic: Document Root of Main Domain  (Read 101 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Document Root of Main Domain
« on: December 10, 2024, 03:24:36 PM »
Hi all,
Moving to a CWP based VPS, and trying to tell it about Laravel based sites I have.

How do I tell it the main domain of a specific account should go to public_html/public as opposed to just public_html? Do I need to modify the Apache config files manually?

For Addon domains its easy, but can't find a GUI way of doing it for the main domain.

Offline
*****
Re: Document Root of Main Domain
« Reply #1 on: December 10, 2024, 07:41:24 PM »
Yes, you must edit the Apache vhost conf (or Nginx if you use that).
Webserver Settings > WebServer Conf Editor > Apache tab > /usr/local/apache/conf.d/vhosts/
Then set it as immutable so it doesn't get blown away on a future update:
Code: [Select]
chattr +i /usr/local/apache/conf.d/vhosts/blah.com.ssl.conf(One of my customers runs a Drupal scaffold install, so their site root is /home/user/public_html/web -- so I set this for them in the Nginx vhost conf file.)

Offline
***
Re: Document Root of Main Domain
« Reply #2 on: December 10, 2024, 08:52:57 PM »
If you use Apache webserver (not Nginx+Apache, OpenLiteSpeed, Nginx, etc) only then just put the following into .htaccess file located in public_html of the website:

Code: [Select]
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

In this case you don't need to edit the webserver's config or make any other changes in the config files.