Adding in a dynamic date

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 16
Joined: 10 Jan 2013, 12:24

Adding in a dynamic date

01 May 2014, 14:41

Hi, want to change part of our site that relies on dynamic date being entered in URL (today's date plus 3 days). Is it possible to use something like:
RewriteRule ^flights/ flightsearch.asp?deptairport=XXX&arrairport=XXX&deptdate=040514 [NC,R=301,L]

But to make deptdate=040514 dynamic?

thanks

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Adding in a dynamic date

02 May 2014, 19:39

Hello,

What do you exactly mean? Get a current date + 3days from somewhere in this exact format? interesting...

User avatar
Posts: 16
Joined: 10 Jan 2013, 12:24

Re: Adding in a dynamic date

07 May 2014, 15:31

Hi Andrew,

If I created a dynamic date (today's date + 3 days = 100514) and dropped it into our current map file, would it be possible to use a RewriteRule as below?

RewriteRule ^flights/ flightsearch.asp?deptairport=XXX&arrairport=XXX&deptdate=100514 [NC,R=301,L]

If so, what would I need to change in order to recognise the dynamic date? Not sure it's even possible, but wanted to ask.

thanks

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Adding in a dynamic date

07 May 2014, 20:43

Hm... interesting... lets try:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteMap mapfile txt:mapfile.txt
RewriteRule ^(flights)/$ flightsearch.asp?deptairport=XXX&arrairport=XXX&deptdate=${mapfile:$1} [NC,R=301,L]


where, in mapfile, you'd have:
flights 100514


Regards

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 0 guests