![](/img/trans.png)
[英]Fix .htaccess error - RewriteCond: NoCase option for non-regex pattern '-f' is not supported
[英]Strange NoCase error in .htaccess
多年来我一直在使用相同的.htaccess来控制apl上的url重写,但是现在我收到以下错误:
[Wed May 08 17:14:16 2013] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.
[Wed May 08 17:14:16 2013] [warn] RewriteCond: NoCase option for non-regex pattern '-d' is not supported and will be ignored.
[Wed May 08 17:14:16 2013] [warn] RewriteCond: NoCase option for non-regex pattern '-l' is not supported and will be ignored.
我的.htaccess如下:
# << Friendly URL's
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php
# >> Friendly URL's
#RewriteCond %{HTTP_HOST} ^mydomain\.com\.br$ [OR]
#RewriteCond %{HTTP_HOST} ^www\.mydomain\.com\.br$
#RewriteRule ^/?$ "http\:\/\/www\.mydomain\.com\.br\/" [R=301,L]
RewriteCond %{HTTP_HOST} !^www.mydomain.com.br$
RewriteRule ^(.*)$ http://www.mydomain.com.br/$1 [R=301]
由于我对.htaccess的使用知之甚少,我不知道发生了什么。 事实上,我很久以前就已经了解了.htaccess来构建这个文件,但它已经不再适用了。 有人可以帮我解决一下如何纠正这个错误吗?
首先十分感谢!
警告消息不适用于您显示的.htaccess文件中的任何行,因为没有为任何语句设置NoCase ( NC )选项。
它们必须来自其他.htaccess文件或apache配置文件,如果您与其他人共享服务器,则可能与您无关。 在任何情况下,警告消息都不表示任何严重问题,只是输入NC选项而不需要它并且没有效果。
如果它是您自己的服务器或您可以控制它,您可以检查这些其他文件并查找包含-d
, -f
或-l
并具有NC
选项的RewriteCond
语句。 然后安全地删除NC
选项以消除警告消息。 例如改变
RewriteCond %{REQUEST_FILENAME} !-f [NC]
至
RewriteCond %{REQUEST_FILENAME} !-f
有关这些警告消息的更多信息,请访问此处 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.