views:

22

answers:

2

Hi there,

tried to find the problem for this but nothings really working.

Basically, I'm trying to use the following regular expression:

RewriteRule ^course/filter:([a-zA-Z0-9_-\,\=]+)$ php/manage_courses.php?display=list&filter=$1 [L]

however I get a 500 error and this in the error log (note the escaped chars):

[Wed Jan 27 16:29:31 2010] [alert] [client ::1] H:/SVN/prj_us/.htaccess: RewriteRule: cannot compile regular expression '^course/filter:([a-zA-Z0-9_-\\,\\=]+)$', referer: http://localhost/~svn/prj_us/php/admin_index.php

It seems to be automatically escaping the \ char, which it shouldn't be doing... I have tried swapping the order of the regexp code, as well as removing the \ altogether but its not working.

Any suggestions? Cheers for your help.

notes: - works without the "\,\=" part, but i need those two chars in particular for the URL that I am trying to rewrite. - all other regexps in the .htaccess file work, although they dont have the two chars as above.

+1  A: 

You shouldn't need to escape anything except the - character in your character class. Try this:

[-a-zA-Z0-9_,=]
mopoke
as much as i am sure i rewrote this heaps of different ways, and tried without escaping 'em, this seemed to work... thanks!
Jacob
A: 

Neither , nor = is special in a range, but - is. Move the - to the beginning, and remove the backslashes.

Ignacio Vazquez-Abrams