Forum Moderators: phranque
<?php
$time = apache_getenv('TIME');
echo $time;
?> RewriteRule ^ - [E=current_date_and_time:%{TIME},E=today:%{TIME_YEAR}%{TIME_MON}%{TIME_DAY},E=this_year:%{TIME_YEAR}] ($sec, $min, $hour, $day, $mon, $year) = (localtime)[0..5];
$date_and_time = "%d%02d%02d%02d%02d%02d", $year + 1900, $mon + 1, $day, $hour, $min, $sec);
The %{ENV:variable} form of TestString in the RewriteCond allows mod_rewrite's rewrite engine to make decisions conditional on environment variables. Note that the variables accessible in mod_rewrite without the ENV: prefix are not actually environment variables. Rather, they are variables special to mod_rewrite which cannot be accessed from other modules.
[edited by: phranque at 9:28 pm (utc) on Dec 11, 2022]