What difference does slash make in apache2.conf?

The default apache2.conf contains this:

<Directory /usr/share>
...
<Directory /var/www/>

Why is there a trailing slash in one but not in the other directive? What difference does it make?

Side question: If I do not want to share anything from /usr/share, can I simply delete this part or set it to Require all denied?


Solution 1:

With regards to the trailing slash, as: https://serverfault.com/a/263219 states, the argument to a Directory directive must be directory path. Without a slash is the convention but either syntax is valid and has the same result.

Note that in other scenario's and in combination with other directives there may be differences, for example disabling the DirectorySlash directive may result in requests for http://www.example.com/directory-path getting different results displayed compared to the request for http://www.example.com/directory-path/

If I do not want to share anything from /usr/share, can I simply delete this part or set it to Require all denied?

Directory statements themselves do not make any content public.
(AFAIK Only the [Script]Alias and DocumentRoot directives and similar map URI paths to the file system.)
Directory blocks only apply specific settings to locations on a file system. That means that you can leave directory blocks like the one for for /usr/share even when you don't share content from there (yet). That does not have any security or performance impact.