Forum Moderators: phranque
RewriteEngine On
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} <$3$2$1
RewriteRule ^([0-9]{2})\-([0-9]{2})\-([0-9]{4})\.(gif¦jpg¦jpeg)$ http://example.com/notfound.htm [R,L] When I substitute a numerical date for the backreferences, it works fine:
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} <20050820 Can anyone tell me why these backreferences aren't working?
Welcome to WebmasterWorld!
Yes, because backreferences can only be used in the left side of a RewriteCond -- See the mod_rewrite documentation. There is no variable-to-variable compare in mod_rewrite. A point solution exists (for certain servers only) using POSIX 1003.2 regex atomic back-references and the principal of equivalence (if A+B = A+A, then A=B), but your best bet is to use PERL or PHP to accomplish your goal.
Jim