New in CWP Edge-LatestFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers, and CWP Cage gives every user complete isolation. Available now in the CWP Edge-Latest version.

Get CWPpro ›

Document Root of Main Domain

Started by playbox, December 10, 2024, 03:24:36 PM

Previous topic - Next topic

playbox

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.

overseer

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:
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.)

cyberspace

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:


<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.