For me this was the simplest article I found which really helped me to figure out what I needed and worked in the end, so I'll share it here and try to use the terms which makes sense to me.
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]
The right hand side (index.php?page=$1
) is the destination which is hidden from the browser.
The left hand side is the mapping rule.
The variable parsed from the left - $1
need not be right at the end of the string and can be anywhere in the middle, for example, /CHECK/?VAR=$1MORETEXT
or if there are more variables to parse from the left, it could be "/CHECK/?VAR=$1MORETEXT$2
".
The "/?
" is optional, if it is desired for the destination URL to not have a "/
" at the end, don't include it and just end with the $
like ^page/([^/\.]+)$
The [L]
is useful because it stops the htaccess from wasting time reading onwards once a matching Rule is found.