views:

286

answers:

2

I have no idea why, but every time I do something with a complex pattern for a RewriteRule in a .htaccess file, I get a 500 internal error. My current .htaccess file in its entirety is:

RewriteEngine on
RewriteRule ^ups/sections/([A-Za-z]{3})/([A-Za-z0-9_-+\.]+)/?$ /dl.php?loct=sec&sec=$1&file=$2 [R=302]

I've tried with only "RewriteEngine on" and get no error. I've tried something really simple like: "RewriteRule ^ups/?$ /xyz [R]" which works perfectly. I've tried with and without the Symlinks option. I've tried with and without a slash at the beginning of the pattern and with and without a slash at the beginning of the replacement.

It seems like whenever I use "complex" looking regex, it just doesn't work.

Note: I don't own this server and can't change apache config files.

Any help would be appreciated.

+1  A: 

Try to change it to

RewriteRule ^ups/sections/([A-Za-z]{3})/([A-Za-z0-9_+.-]+)/?$ /dl.php?loct=sec&sec=$1&file=$2 [R=302]
yuku
Well I feel stupid...
Shadow
A: 

To explain your mistake: Inside a character class the dash (-) doeas allways describe a range between two characters. except it appears at the start or the end of the character class. But your range from _ to + is invalid as the _ (0x5F) has a higher position than + (0x2B).

Gumbo