I am new to Craft CMS and am struggling with what and how to get the correct files in the right places. I started out with a LAMP stack on a Ubuntu 18.04 Digital Ocean droplet and proceeded with the Craft CMS setup. Currently I get a 404 ERROR stating "The requested URL /index.php was not found on this server".

Where should I put it? Does this answer help and still work in this case : https://stackoverflow.com/questions/5891802/how-do-i-change-the-root-directory-of-an-apache-server/23175981#23175981?

My VH file:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/craftcms
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/html/craftcms/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

     <Directory /var/www/html/craftcms/>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*) index.php [PT,L]

1 Answer 1


If the craftcms folder is more or less the out-of-the-box Craft 3 installation, you should be able to just point your Directory blocks and DocumentRoot at /var/www/html/craftcms/web!

Only the web folder is intended to be public—everything else should be hidden, above the web root—think of it as sandboxing access to just one folder of your application.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.