On my local WAMP server the following lines in .htaccess cause no problems, and do what I want:
RewriteEngine On
Options FollowSymLinks
RewriteRule ^foo/([0-9]+)/[a-z0-9-]*?$ foo.php?id=$1 [L]
When I upload this to my hosted (LAMP) site it causes a 500 error (regardless of whether the rewriterule comes in to play or not). After much tinkering, the fix was to make remove the unhungry/lazy modifier to the regex, i.e.:
RewriteEngine On
Options FollowSymLinks
RewriteRule ^foo/([0-9]+)/[a-z0-9-]*$ foo.php?id=$1 [L]
Now, in the case I've presented it's arguable whether the difference in the regex serves any purpose, but still to my mind the first example is valid, and it did work on my local WAMP server. So does anyone have a clear idea why I got the 500 error?
Add slash before foo.php:
or move rewrite rules from virtual host config to .htaccess.