What is the difference between DocumentRoot and Directory in apache2 for mac os x [closed]

Solution 1:

DocumentRoot is the location on your web server from which the web server will serve files if a user visits http://prestashop16.dev/. All of your web-visible files should be at or below that folder's level.

The Directory block lets you specify Apache configuration rules that should only apply to a specific directory.

The two do not have to match, and a <Directory> block can be placed within a VirtualHost block or in the general server config, according the the Apache docs.

Also, you can have multiple Directory blocks. For example, if your DocumentRoot was var/www and you wanted to restrict access to /var/www/private you could create <Directory /var/www/private></Directory> block and place your desired security configurations in there without affecting other folders.