heres a code i use to protect my gallery files from being accessed outside the site
also the directory listing will not show these file types
.htaccess
this file makes it look like the files dnt exist but its just a 403 forbidden error
404.php
also the directory listing will not show these file types
.htaccess
PHP Code:
<FilesMatch "\.(jpe?g|png|gif|bmp)$">
Order Deny,Allow
Deny from all
ErrorDocument 403 /404.php
</FilesMatch>
404.php
PHP Code:
<?
echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL $_SERVER[REQUEST_URI] was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
$_SERVER[SERVER_SIGNATURE]</body></html>";
?>
Comment