2

I added

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} /article/
RewriteRule ! ^article/\d+ redirect.php [L]

to .htaccess and got a .htaccess: RewriteRule: bad flag delimiters message. Reviewed the related questions here but they didn't help.

1 Answer 1

1

Compare

RewriteRule ! ^article/\d+ redirect.php [L]
RewriteRule !^article/\d+ redirect.php [L]

Yes, the second works. You can't have a space between the ! and the pattern. AFAICS this is not mentioned in the Apache docs.

1
  • The ! prefix-operator is part of the argument and spaces are argument delimiters. In your first example redirect.php consequently gets interpreted as the 3rd (flags) argument, which is obviously invalid - hence the error.
    – MrWhite
    Commented Nov 18, 2022 at 13:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .