**update**

    RewriteCond !-d
    RewriteRule ^(.*)/$ ?page=$1 [NC,L]
    
    RewriteCond %{REQUEST_URI} !index.php
    RewriteRule ^(.*)$ ?page=$1 [NC,L]

This first rewrites urls with a slash, but only if it's not an existing directory.

If that's not found it rewrites urls without a slash (but only if it's not index.php, so already rewritten urls are ignored).