Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored

Tags:

mod-rewrite

Following is my .htaccess. It works good, but I got an error in error_log file:

[warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.

<Files .htaccess>
order allow,deny
deny from all
</Files>

#Options +FollowSymlinks
DirectoryIndex index.php
Options All -Indexes

RewriteEngine on
# remove trailing slash
RewriteRule ^(.*)/$ /$1 [L,R=301]

#Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^part_(\d+)$        /detail.php?id=$1 [NC]
RewriteRule ^find_(.+)$     /search.php?q=$1 [NC]
like image 960
David Lee Avatar asked Feb 23 '23 03:02

David Lee


1 Answers

Not sure if this helps, but according to this website, if you see the following error in Apache error log:

[warn] RewriteCond: NoCase option for non-regex pattern ‘-f’ is not 
       supported and will be ignored

You should change the following line in your .htaccess or httpd.conf

RewriteCond %{REQUEST_FILENAME} !-f [NC]

to

RewriteCond %{REQUEST_FILENAME} !-f

Note the missing [NC] at the end of the line.

like image 53
zach Avatar answered Apr 06 '23 08:04

zach