htaccess redirect based on date
So this should be pretty simple, but it isn't working. I have the following code:
RewriteEngine on
RewriteCond %{TIME_DAY} >12
RewriteRule /orderforms/page1.aspx.*$ https://www.site.net/orderforms/page2.aspx [R=301,QSA]
But even though it's not the 12th yet, it's still redirecting. Any ideas? Is this not fully supported? Thanks!
(I开发者_如何学Go'm using ISAPI_Rewrite, though I don't think that should make any difference in this case)
Note that the pattern matching on RewriteCond
is lexiographic, not numerical.
111 < 12
3523 < 34
etc.
Assuming format for %{TIME_DAY} is TWO digits and ranging from 01 to 31. Note that I don't know it's exact format, but this could still help you.
You could pull it off by using a regular expression on the condition:
RewriteCond %{TIME_DAY} ^[1-3][0-9]$
RewriteCond %{TIME_DAY} ^1[^012]$
Which accepts only a 1, 2 or a 3 in the first digit position and 0 ... 9 in the second digit position. You also need another RewriteCond to filter the unwanted 10, 11 and 12.
精彩评论