Your request for URL $dir is a directory, the index file in it will be fetched by selecting the link below.
$dir/