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.

chx
  • 1,705

1 Answers1

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.

chx
  • 1,705
  • 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 Nov 18 '22 at 13:02