Forum Moderators: phranque

Message Too Old, No Replies

Rewrite Rule Resulting in Bad Flag Delimiters

         

rob001

9:37 am on Jul 1, 2008 (gmt 0)

10+ Year Member



Hi, I've been tearing my hair out over this one. It is probably so simple, but I simply can not work it out, even after reading countless articles on mod-rewrite. I have the following code:

RewriteRule ^uploads/applicants/([^/]+)/(.*)$ /admin/careers.php?action=downloads&applicant=$1&file=$2 [NC, L]

Which is returning a server error with Bad Flag Delimiters as the cause. I really, really can't work out what is wrong in this line. What it needs to do is take the request uploads/applicants/applicantname/applicantfile.fileextension and redirect to admin/careers.php?applicant=applicantname&file=applicantfile.fileextension .

Any help would be really, really appreciated!

jdMorgan

1:43 pm on Jul 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Remove the space preceding "L" in the flags on your rule -- it must be "[NC,L]" and not "[NC, L]".

To maintain inner peace and serenity, do not confuse mod_rewrite with a programming language, where you are free to use 'stylistic variations' in coding. mod_rewrite --like all other Apache modules-- uses very-simple directive parsers in order to be 'lean and mean' and fast. As such it is utterly unforgiving of any deviation from the specified syntax.

Combined with its use of regular expressions, the result is that every single character in a mod_rewrite directive is significant. As demonstrated here, one missing or incorrect character can bring your server down -- or even worse, cause a pattern to match unexpectedly but only infrequently -- say once every six months, leaving you with a practically-unfindable problem.

Jim