I have a mod_rewrite that is meant to check a date value and redirect as appropriate.
The capture group appears to work on testing with online .htaccess
tester but in the live environment it’s not redirecting correctly.
htaccess is here:
<code>RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^events-coming-up/([0-9-]){10}/?$ /events-coming-up.php?date=$1 [NC,L,QSA]
</code>
<code>RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^events-coming-up/([0-9-]){10}/?$ /events-coming-up.php?date=$1 [NC,L,QSA]
</code>
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^events-coming-up/([0-9-]){10}/?$ /events-coming-up.php?date=$1 [NC,L,QSA]
This should match:
<code>events-coming-up/2024-08-17#anchorPoint</code><code>events-coming-up/2024-08-17#anchorPoint </code>events-coming-up/2024-08-17#anchorPoint
but doesn’t.
The intention of the capture group is to only select 10 characters of 0-9
or -
so if there’s a URL like:
<code>events-coming-up/deadmeat01#anchorPoint</code><code>events-coming-up/deadmeat01#anchorPoint </code>events-coming-up/deadmeat01#anchorPoint
This should not match.
This works correctly on pure regex testing but doesn’t seem to be working on the .htaccess.
Apache 2.4
How can I fix this?