httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Campbell, Lance" <la...@illinois.edu>
Subject RE: [users@httpd] Re: RewriteCond how to set variable
Date Tue, 21 Dec 2010 15:58:56 GMT
Thanks for your response.  I get the following error message:
RewriteCond: unknown flag 'E'

What I used:
RewriteCond %{QUERY_STRING} !XSL=NONE [NC]
RewriteCond %{QUERY_STRING} calId=([0-9]+) [E=CALID:%1]
RewriteCond %{QUERY_STRING} skinId=([0-9]+) [E=SKINID:%1]
RewriteRule ^/calendar/list
http://test.webservices.illinois.edu/calendar/list/%{CALID}?skinId=%{SKI
NID} [L]



Thanks,

Lance Campbell
Software Architect/DBA/Project Manager
Web Services at Public Affairs
217-333-0382


-----Original Message-----
From: Andrew Schulman [mailto:andrex@alumni.utexas.net] 
Sent: Tuesday, December 21, 2010 9:41 AM
To: users@httpd.apache.org
Subject: [users@httpd] Re: RewriteCond how to set variable

> I have the following RewriteCond.  I put numbers in front of each line
> for reference:
> 
> 1)      RewriteCond %{QUERY_STRING} !XSL=NONE [NC]
> 
> 2)      RewriteCond %{QUERY_STRING} calId=([0-9]+) [NC]
> 
> 3)      RewriteCond %{QUERY_STRING} skinId=([0-9]+) [NC]
> 
> 4)      RewriteRule ^/calendar
> http://test.webservices.illinois.edu/calendar/list/%1?skinId=%2
> <http://test.webservices.illinois.edu/calendar/list/%251?skinId=%252>
> [L]
> 
> I just learned that when you use %1 and %2 in line 4 it will only
> reference the last RewriteCond.  So in line 4 the %1 comes from line 3
> but the %2 is blank.  I actually wanted the values from line 2 & 3 to
be
> inserted into line 4.
> 
> How do you set a local variable in line 2 and 3 so that in line 4 I
can
> reference them?  

This isn't too pretty.

RewriteCond %{QUERY_STRING} calId=([0-9]+) [NC]
RewriteRule .* - [E=calId:%1]

RewriteCond %{QUERY_STRING} skinId=([0-9]+) [NC]
RewriteRule .* - [E=skinId:%1]

RewriteCond %{QUERY_STRING} !XSL=NONE [NC]
RewriteCond %{calId} .
RewriteCond %{skinId} .
RewriteRule ^/calendar
http://test.webservices.illinois.edu/calendar/list/%{calId}?skinId=%{ski
nId}
[L]

(I'm not sure if your original RewriteRule came through correctly - I
think
I've interpreted it right.)

I'm not 100% sure about the use of %{calId} and %{skinId} in the
substitution string of the RewriteRule.  I think it's right, but try it.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message