Task: take all requests to /directory with exceptions of some file types and direct to a script for the purpose of outputting dynamic URL's based on the browser version.
Expected potential inputs (not counting css, etc.)
/directoryname
/directoryname/
/directoryname/index.html
Anything else will 404, which is what we want.
The commented lines are probably not efficient, but they generate 500's on this particular Linux dedicated server whereas they work fine on others. The uncommented name works, but it's a hard coded value, which will bloat up the .htaccess as it grows.
I'm "decent" at regexps and can't figure out why the thirds/fourth ones ([^/]+) 500. I've tested across a couple servers, it only fails on the one I need it to work on. :-)
RewriteCond %{REQUEST_URI} !\.css|\.js|\.gif|\.jpg|\.png$
RewriteRule ^(directoryname)\/*(.*) /cgi-bin/page-parser.cgi?d=$1&p=$2 [NC,L]
#RewriteRule ^(\w+)\/*(.*) /cgi-bin/page-parser.cgi?d=$1&p=$2 [L]
#RewriteRule ^(.+)\/*(.*) /cgi-bin/page-parser.cgi?d=$1&p=$2 [L]
#RewriteRule ^([^/]+)\/*(.*) /cgi-bin/page-parser.cgi?d=$1&p=$2 [L]
#RewriteRule ^([^\/]+)\/*(.*) /cgi-bin/page-parser.cgi?d=$1&p=$2 [L]