修复.htaccess错误 - RewriteCond:非正则表达式的NoCase选项' -f'不受支持

时间:2016-01-06 15:10:36

标签: php regex apache .htaccess

我在.htaccess引起的error.log中出现此错误:

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

它说什么?如何解决?

这是.htaccess档案:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]

根据error.log,第11行是导致问题的原因:

RewriteCond %{REQUEST_FILENAME}.php -f [NC]

1 个答案:

答案 0 :(得分:0)

基于@anubhava建议我已从第11行删除了[NC],错误消失了。