So i'm wondering how you professionals go about securing your website by not allowing a user to manually input a url to a certain folder such as website.com/images/ and view a directory listing. The method i've been using is placing an index.php file and using this code, which just brings the user back to main homepage. But i feel like there is probably an easier way to do this. Possibly Server Side?
<?php
ob_start();
/* This will give an error. Note the output
* above, which is before the header() call */
header('Location: ../index.php');
exit;
?>