This case should be handled by .htaccess file which you should have in your web directory. To make this work you need to have apache mod_rewrite enabled and have a proper configuration of your VirtualHost: you need to have AllowOverride All in your Directory directive
BTW: Your server shows list of files in directory - this is considered to be dangerous in production server. Disable it by Options -Indexes in your VirtualHost configuration.
So your VirtualHost configuration should have (this is apache 2.4 conf):
<Directory /path/to/your/web/>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>