I am new in mod_rewrite regular expressions. I have the following lines in my .htaccess file:
RewriteRule ^gallery/([0-9]+)/ gallery.php?id=$1 [L]
RewriteRule ^gallery/ gallery.php [L]
When I open http://127.0.0.1/gallery/
everything is OK, but when I open http://127.0.0.1/gallery/some_string
it opens the same page. How can I force such invalid URL-s to go to my 404 page. I need the second line to be strict - with no extra characters after the last slash and the first rule must continue to work with integer values.
Any ideas how to achieve this?