On the net I found several ways of defining a RewriteRule like:
RewriteRule .? 404.php [L]
RewriteRule . 404.php [L]
RewriteRule ^ 404.php [L]
But why would these work when entering a garbage url? Because the first (.?)
means that there should be zero or one char which would lead to 404.php (not a whole bunch of chars or a word). Likewise, .
and ^
look only for a char and a start of a line (not a line with a few chars or words, right?), respectively. That's what I think based on the RegEx help. Am I wrong? Or ...?