I need to rewrite all URLs in a specific format to their matching querystring'd URL and everything else should go to index.php?valid=false
I have:
RewriteRule (^[^\s]{4})/([0-9]{4})/(winter|fall|summer)/([0-9]{4})/?$ index.php?valid=true&subject=$1&course=$2&semester=$3&year=$4 [NC,L]
RewriteRule (.*)/?$ index.php?valid=false [NC,L]
The first rule is working fine: 4 letters, 4 numbers, fall or winter or summer, 4 numbers. And it seems like the second rule is working because everything is currently redirecting to the ?valid=false
page. However, even URLs that are accepted by the first rule (when the 2nd one is commented out) pass through to the second one, even though they should be stopped by the [L]
flag?
Am I doing it wrong?
Thanks!