RewriteEngine On

#Security
ServerSignature Off

#Secure htaccess file
<Files .htaccess>
 order allow,deny
 deny from all
</Files>

#Protect config.php
<Files config.php>
 order allow,deny
 deny from all
</Files>

#ErrorDocuments file
ErrorDocument 400 /error.php?code=400
ErrorDocument 401 /error.php?code=401
ErrorDocument 403 /error.php?code=403
ErrorDocument 404 /error.php?code=404
ErrorDocument 500 /error.php?code=500

#For files and directories that doesn'exit
<IfModule mod_rewrite.c>
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ /error.php?code=404 [R=301,L]
</IfModule>

#Security Announcements regarding ImageMime Exploits start
<FilesMatch '(?i).jpe?g$'>
 ForceType image/jpeg
</FilesMatch>
<FilesMatch '(?i).gif$'>
 ForceType image/gif
</FilesMatch>
<FilesMatch '(?i).png$'>
 ForceType image/png
</FilesMatch>
