Forum Moderators: phranque

Message Too Old, No Replies

Need help with RewriteCond system stuff TIME

TIME_YEAR TIME_MON TIME_DAY and so on

         

twist

3:54 am on Mar 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The other day Jim was helping me with this thread,

[webmasterworld.com...]

It turns out that, at least on my server, TIME_DAY is "day of month" and not "day of year", but I would rather have "day of year", so I started a search on google, apache and webmasterworld but could find absolutely nothing on anything related to RewriteCond and the system stuff: TIME variables.

If someone knows where this is explained that would be great, if not, then could we create a short tutorial here for future reference since I can't seem to find it anywhere else and I don't know how to echo statements in htaccess to find out on my own much less of trial and error, if there is a way to echo statements in htaccess I would also like to know that since I can't find any info on that either.

TIME_YEAR = What format 2005 or 05 or?
TIME_MON = Day of Month, don't know what format thouth 02 or just 2(at least on my server)
and so on...

Would also like to know how to mix and match these to create useable dates or perhaps get the day of the year.

jdMorgan

10:24 pm on Mar 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For an echo statement, I usually turn the rewrite into an external redirect, so that it updates my browser address bar, and append the varables I want to investigate to the URL as a query string.

E.g.


RewriteRule ^test_time\.html$ /time_test.html?year=%{TIME_YEAR}&month=%{TIME_MONTH}&day=%{TIME_DAY} [R=301,L]

Request the URL "/test_time.html" from your server, and then look at the address bar. Unless your 404 error handler does another redirect, you should see the time variables. To avoid the 404, simply redirect the test page request to a page that exists, but won't be disturbed by having those variables appended to the URL.

Jim

twist

6:09 am on Mar 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thats really cool jim, thanks. It will come in very handy.