numeric RewriteRule with .htaccess
-
19-09-2019 - |
Question
I would like to send URL requests to a PHP script which will handle the 301. The URI's I want to capture are dates, like 26-11-2010, without the dashes:
www.mysite.com/261110/ (6 digits)
What is the RewriteRule for this? my script is
www.mysite.com/redirect.php?data=261110
Solution
RewriteRule ^([0-9]{6})/$ /redirect.php?data=$1 [L]
will match any string of 6 digits (whether they are dates or not)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow