Can mod_rewrite compare two variables/backrefs?

New to mod_rewrite? This is a good place to start.

Can mod_rewrite compare two variables/backrefs?

Postby foopah791 » Tue Mar 14, 2006 7:23 am

Hi,

I am trying to take a value from QUERY_STRING and compare it to a time var, but I can't get it to work. I have tried several different ways:
Code: Select all
### URL looks like http://www.somesite.com?norewrite2006031410
# This does not work
RewriteCond %{QUERY_STRING} ^.*norewrite([0-9]{10}).*$
RewriteCond %1 =%{TIME_YEAR}%{TIME_MON}%{TIME_DAY}%{TIME_HOUR}

#This does work
RewriteCond %{QUERY_STRING} ^.*norewrite([0-9]{10}).*$
RewriteCond %1 =2006031410


I am really trying to do something like:
Code: Select all
### URL looks like http://www.somesite.com?norewrite2006031410
#doesn't work
RewriteCond %{QUERY_STRING}x%{TIME_YEAR}%{TIME_MON}%{TIME_DAY}%{TIME_HOUR} ^.*norewrite([0-9]{10})x([0-9]{10}).*$
RewriteCond %1 <%2

#also does not work
RewriteCond %{QUERY_STRING}x%{TIME_YEAR}%{TIME_MON}%{TIME_DAY}%{TIME_HOUR} ^.*norewrite[0-9]{10}x\1.*$

#This works
RewriteCond %{QUERY_STRING}x%{TIME_YEAR}%{TIME_MON}%{TIME_DAY}%{TIME_HOUR} ^.*norewrite([0-9]{10})x([0-9]{10}).*$
RewriteCond %1 <2006031410


In the cases above, it is the second line that does not match.
It seems like variables are not allowed on the condition pattern side of a RewriteCond.

Is this true?
Does anyone have suggestions as to how I can do this sort of comparison?
foopah791
 
Posts: 2
Joined: Tue Mar 14, 2006 6:04 am

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 10 guests

cron