I’ve been trying to figure this out, but can’t seem to get it to work. If anyone could help out by letting me know if my rule is correct or not, I can maybe figure out what the issue might be if its somewhere else.
RewriteEngine on simply ensures that the mod_rewrite engine is not in the comment mode, i.e., required only in unusual circumstances. Rémon is spot-on removing the leading / (in the DocumentRoot with this mod_rewrite code) and Last flag but I take exception to changing the directory level TWO times with that trailing / of his (it will impact the directory level of your relative links).
It’s a very minor point that the leading / in the redirection makes Apache look first to the SERVER’s root THEN to the domain’s DocumentRoot (where you have this code - so you don’t need that /). If an index.php exists in the server’s root, it will receive the redirection. Of course, any other filename COULD result in a security issue.
With those explanations, I would recommend:
RewriteEngine on
RewriteRule ^subfolder/([0-9]+)$ index.php?LodgeID=$1 [L]
Note that your “subfolder” need not exist (and probably shouldn’t) as it’s only being used as a “marker” to activate the mod_rewrite redirection.