# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5 .php

RewriteEngine On
Options -Indexes 

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* / [F]
RewriteRule ^obsolete.html$ - [L]

#deny pdf
RewriteCond %{REQUEST_URI} \.(pdf|doc)$ [NC]
RewriteRule .* - [F,L]

RewriteCond %{REQUEST_URI} !(/$|\.) 
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} !-f 


# OK-> RewriteRule ^ente/([a-zA-Z0-9_-]{1,40})/([a-zA-Z0-9_-]{1,40})?[/]?$ index.php?e=$1&m=$2 [L,QSA]
RewriteRule ^ente/([a-zA-Z0-9_-]{1,40})/diag/([a-zA-Z0-9_-]{1,20})/$ includes/pages/ente/dialogs/$2.php [L,QSA]
RewriteRule ^ente/([a-zA-Z0-9_-]{1,40})/([a-zA-Z0-9_-]{1,40})?[/]?([a-zA-Z0-9_-]{1,40})?[/]?$ includes/modules/index.php?e=$1&m=$2&mp=$3 [L,QSA]
RewriteRule ^ente/([a-zA-Z0-9_-]{1,40})/([a-zA-Z0-9_-]{1,40}).html$ index.php?e=$1&m=$2 [L,QSA] [L,QSA]


RewriteRule ^xml/([a-zA-Z0-9_-]{1,20})/$ includes/xml.php?data=$1 [L,QSA]
RewriteRule ^([a-zA-Z0-9_-]{1,40})/diag/([a-zA-Z0-9_-]{1,20})/$ includes/modules/$1/dialogs/$2.php [L,QSA]
#RewriteRule ^captcha/$ includes/classes/securimage/securimage_show.php [L,QSA]
RewriteRule ^captcha/$ includes/classes/cool-php-captcha/captcha.php [L,QSA]
RewriteRule ^download/$ includes/download.php [L,QSA]
RewriteRule ^([a-zA-Z0-9_-]{1,40})/$ index.php?m=$1 [L,QSA]
RewriteRule ^([a-zA-Z0-9_-]{1,40}).html$ index.php?m=$1 [L,QSA]

