Disable Script Execution Using .htaccess
You can disable scripts being run in the directory of your choice by adding the following code to your .htaccess file in that directory
This would be particularly useful if you allow visitors to upload files to your server, but want to be sure that any potentially harmful files they upload are not allowed to execute.
AddHandler cgi-script .php .pl .jsp .asp .sh .cgi
Options -ExecCGI
You can replace the file types in the example with the file types you wish to disallow using .htaccess.
How to disable serversignature using .htaccess
To disable the server’s signature used to identify the server, use the following code in your .htaccess file:
.htaccess Hotlink protection for files on your server.
You can stop others from hotlinking your site’s files by placing a file called .htaccess in your Apache site root (main) directory. The period before the name means the file is hidden.
Example: Your site url is www.mysite.com. To stop hotlinking of your images from other sites and display a replacement image called nohotlink.jpe placed in your images directory, place this code in your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/blockhotlink.jpe [L]
The first line of the above code begins the rewrite. The second line matches any requests from your own mysite.com url. The [NC] code means “No Case”, meaning match the url regardless of being in upper or lower case letters. The third line means allow empty referrals. The last line matches any files ending with the extension jpeg, jpg, gif, bmp, or png. This is then replaced by the blockhotlink.jpe file in your images directory. This JPEG image is using the extension jpe instead of jpg to prevent blocking your own replacement image.