Page 1 of 1

Rewrite Condition error in logs

Posted: Sat Jun 23, 2007 8:59 am
by tkeil69575
Hi all,
I just thought I'd share this, in case anyone else has this problem ...

I use mod_rewirte for clean urls with the rules suggested in the cmsms documentation found somewhere ... they are as follows
RewriteEngine on

RewriteBase /
# 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 ^(.+)$ index.php?page=$1 [QSA]
It all works fine, expect my logs (Apache 2.2.0) are filling up with the following errors:

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


... so to get rid of the errors I had to change the following lines above to:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


(e.g. get rid of the [NC] behind these two conditions).

tina

Re: Rewrite Condition error in logs

Posted: Sat Jun 23, 2007 9:13 am
by cyberman
Hi Tina,

thanks for hints :) ...

Re: Rewrite Condition error in logs

Posted: Sat Jun 23, 2007 6:37 pm
by Pierre M.
Hello Tina,
thank you for the feedback.
tkeil69575 wrote: I use mod_rewirte for clean urls with the rules suggested in the cmsms documentation found some here ... they are as follows
I'd like to stress that these rules "found here" (in some forum threads, I suppose) are not the ones suggested in the CMSms documentation. The doc provided sample .htaccess is simpler and doesn't contain anything to add trailing slashes to URLs. Please read the official doc (which should work out of the box) before trying other things.

BTW, I don't understand why some want to postfix their URLs with trailing slashes :
-it is somewhat wrong with the web document model : a slash postfixed resource is rather a node than a leaf.
-I don't see why /some/xyz/url/ is superior to /some/xyz/url (or /some/xyz/url.html)
-some bots or users may try /some/xyz/url/index.html and this may lead to 404 or duplicate content (hence Google blacklisting) depending of your rewrite rules.
-it adds to rewriting complexity.

Pierre M.

Re: Rewrite Condition error in logs

Posted: Sat Jun 23, 2007 8:17 pm
by tkeil69575
Pierre M. wrote: I'd like to stress that these rules "found here" (in some forum threads, I suppose) are not the ones suggested in the CMSms documentation. The doc provided sample .htaccess is simpler and doesn't contain anything to add trailing slashes to URLs. Please read the official doc (which should work out of the box) before trying other things.
Hi Pierre,
Please look closely at:
http://wiki.cmsmadesimple.org/index.php ... retty_URLs

Is that not official documentation ? What I used and quoted above, looks very similar to what is suggested by CMSms to me, but then I guess I could be blind ;)

tina

Re: Rewrite Condition error in logs

Posted: Sun Jun 24, 2007 3:29 pm
by Pierre M.
Hello Tina,

you are right, you are hopefully not blind. I wasn't aware of this section of the wiki. I thought everything about pretty URLs was (logically) at the end of the install guide in the post install optional settings. And in the last cmsms package I downloaded the sample .htaccess file was simpler and enough, without slashes postfixed.

Now I read your link and I understand why so many people bother with trailing slashes.

I should take some time to try to reconcile those two diverging sections of the official documentation.
Thank you again for reporting so precisely.

Pierre M.

Re: Rewrite Condition error in logs

Posted: Mon Jun 25, 2007 9:01 am
by tkeil69575
Hi Pierre,
ah I see, ok, I guess I could have been more precise in my first posting ... that would have avoided the confusion. I will have a look at the other documentation you mentioned ... I have to agree with you that if something can be done simpler, its usually better.

tina