Finally I got the solution!!! It's not simple, and I don't really understand how it works. I tried Adam Dimech's code, that can be found in this page.
The code is:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.]+\.php(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.example.com/yourdirectory/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ http://www.example.com/yourdirectory/$1/ [R=301,L]
This code has to be put in each directory where we will be working with. If you use relative paths you have to use
The code worked fantastic. Now I can take off the php extension and force the trailing slash. Hope it's useful for more people!