## Can be commented out if causes errors, see notes above.
#Options -Indexes
Options +FollowSymLinks
Options -Multiviews 
##Options +ExecCGI
##AddHandler cgi-script cgi pl
## Mod_rewrite in use.

Options +ExecCGI
AddHandler cgi-script .cgi .pl .php

##RewriteEngine On

RewriteBase /cgi-bin/


RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script that includes a <javascript> tag in URL.
RewriteCond %{QUERY_STRING} ^.*(;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC,OR]
RewriteCond %{QUERY_STRING} javascript [NC,OR]
RewriteCond %{QUERY_STRING} href [NC,OR]
RewriteCond %{QUERY_STRING} document.getElementsByTagName [NC,OR]
RewriteCond %{QUERY_STRING} onmouseover [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.html [F]
#
# End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#


## Begin - Joomla! core SEF Section.
#
##RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

ErrorDocument 400   /biop/error.php
ErrorDocument 401   /biop/error.php 
ErrorDocument 403  /biop/error.php
ErrorDocument 404  /biop/error.php
ErrorDocument 500 /biop/error.php

RewriteCond %{HTTP_REFERER} !/cgi-bin/.*$ [NC]

RewriteCond %{REQUEST_URI} !/cgi-bin/search.html [NC]
RewriteCond %{REQUEST_URI} !/cgi-bin/searchpdb.cgi [NC]
RewriteCond %{REQUEST_URI} !/cgi-bin/searchorg.cgi [NC]
#RewriteCond %{REQUEST_URI} !a.php [NC]
RewriteCond %{REQUEST_URI} !/HD-RNAS.html [NC]
RewriteCond %{REQUEST_URI} !/bioinformatics.html [NC]
RewriteCond %{REQUEST_URI} !/pdbdata.txt [NC]

RewriteRule ^(cgi-bin) - [F,L,NC]

