There is such a code
RewriteEngine on RewriteRule ^([-a-zA-Z0-9_]+)/([0-9]+)/? index.php?page=$1&id=$2 [L]
When you enter http: // localhost / document / 1 / - everything works fine
what if
http: // localhost / document / - error
How to make the second variable optional?