Page 1 of 1

Getting lots of NoCase option errors with Apache and mod_rewrite

Posted: Wed Feb 21, 2007 7:41 pm
by monghidi
Hi!

I'm running CMSMS 1.04 on apache 2.2.3, and PHP 5.1.6. In config.php, I have:
  $config['assume_mod_rewrite'] = true;
  $config['page_extension'] = '.html';
  $config['internal_pretty_urls'] = true;
  $config['use_hierarchy'] = true;
  $config['query_var'] = 'page';


I'm using an .htaccess that I found through this forum. It reads:

  Options +FollowSymLinks
  RewriteEngine on
  RewriteBase /_cms/

  # 301 Redirect all requests that don't contain a dot or trailing slash to
  # include a trailing slash
  RewriteCond %{REQUEST_URI} !/$
  RewriteCond %{REQUEST_URI} !\.
  RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

  # Rewrites urls in the form of /parent/child/
  # but only rewrites if the requested URL is not a file or directory
  RewriteCond %{REQUEST_FILENAME} !-f [NC]
  RewriteCond %{REQUEST_FILENAME} !-d [NC]
  RewriteRule ^(.+).html$ index.php?page=$1 [QSA]


Pretty URL's work fine, except my apache error log is filling up with tons of entries that look like this:

[Wed Feb 21 11:27:11 2007] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.
[Wed Feb 21 11:27:11 2007] [warn] RewriteCond: NoCase option for non-regex pattern '-d' is not supported and will be ignored.


I've searched quite a bit, with no luck so far.
Question: How can I stop this error condition from occuring?

Any help or pointers would be VERY gratefully received!

Thank you!

Re: Getting lots of NoCase option errors with Apache and mod_rewrite

Posted: Wed Feb 21, 2007 7:46 pm
by tsw
hmm, the [NC] flag means NoCase, but I really think that apache2 should support it...

Re: Getting lots of NoCase option errors with Apache and mod_rewrite

Posted: Thu Mar 01, 2007 4:33 pm
by monghidi
Thanks, tsw.

After doing lots of checking, tweaking .htaccess, tweaking httpd.conf, and googling the heck out of it, I think the NC option *is* supported and that my problem is that somehow -d and -f are "non-regex patterns" that throw wrenches into it.

Hrm, any other thoughts?

Re: Getting lots of NoCase option errors with Apache and mod_rewrite

Posted: Thu Mar 01, 2007 6:49 pm
by Pierre M.
monghidi wrote: Hrm, any other thoughts?
Not much...
-d and -f are not regex pattern but valid RewriteCond expressions. Seems ok to me.
I would have written RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA]
instead of RewriteRule ^(.+).html$ index.php?page=$1 [QSA]
but this is not a useful though...
You are running bleeding edge software (latest versions combined), so maybe you are debugging a bit ?
Pierre M.

Re: Getting lots of NoCase option errors with Apache and mod_rewrite

Posted: Tue Apr 24, 2007 12:20 pm
by moorezilla
I recently upgraded to Ubuntu 7.04 which ships with a newer version of Apache (version 2.2) and also php 5.2 instead of 5.1.

I did not get errors in my Apache error.log before making this upgrade, but now I get a long line of:

[Tue Apr 24 07:56:32 2007] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.
[Tue Apr 24 07:56:32 2007] [warn] RewriteCond: NoCase option for non-regex pattern '-d' is not supported and will be ignored.

I have posted a question on the Ubuntu forum and I will put the reply here if I get one.

am

edit... if you just delete or comment out the no case from the .htaccess lines covering {REQUEST_FILENAME} the errors stop and everything seems to work correctly.

RewriteCond %{REQUEST_FILENAME} !-f
#[NC]
RewriteCond %{REQUEST_FILENAME} !-d
#[NC]

Anyone know off-hand if this is a bad solution? I don't see the advantage of the [NC] on those lines if Apache claims it ignores them any way.

Re: Getting lots of NoCase option errors with Apache and mod_rewrite

Posted: Tue Apr 24, 2007 3:23 pm
by Pierre M.
monghidi wrote:   $config['assume_mod_rewrite'] = true;
  $config['internal_pretty_urls'] = true;
Hello again,
just a litle thought : aren't these two lines incompatibles ?
mod_rewrite is an "external" pretty URLs mechanism, so I think there should be $config['internal_pretty_urls'] = false;
But I agree this has nothing to do with what you have found so far.
Pierre M.