Solved

Using filesMatch for multiple file types with auto_append_file

Posted on 2004-07-30
6
590 Views
Last Modified: 2010-03-04
I currently use the following in my .htaccess file to log visits to html files in a given directory.

               <FilesMatch "\.(html?)$">
               php_value auto_append_file "/usr/home/myspace/WWW/html/count.php"
               </FilesMatch>

I want it to log ALL files except .css files.

This includs (but is not limited to):
          .jpg
          .gif
          .png
          .html
          .htm
          .php

Can I have it log all files EXCEPT ones that end with .css?

If not, do I have to list all posible extentions out right?

Thanks!
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 18

Expert Comment

by:CrYpTiC_MauleR
ID: 11683565
<FilesMatch "\.([^c][^s][^s][a-z0-9]+?)$">

you can try this...
0
 
LVL 16

Author Comment

by:hankknight
ID: 11687680
Thanks!  This is still not working for my .png, .gif and .jpg files.  

Any ideas why?
0
 
LVL 18

Accepted Solution

by:
CrYpTiC_MauleR earned 500 total points
ID: 11688482
Are the images coming up? I have never tried including a file into an image, seeing that it might corrupt the image file and make it not display.

Try this slight variation....

 <FilesMatch "\.([^c][^s][^s][a-z0-9]?)$">

Should allow any 3-4 character extension and not allow .css


Also do this...

<Files ~ "\.([^c][^s][^s][a-z0-9]?)$">
ForceType application/x-httpd-php
</Files>


So it allows the PHP engine to parse any file except .css otherwise image files wont have PHP engine include the file.
Keep me posted on the progress, once this gets figured out will probably use it on my site too =oP. Good luck!
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 38

Expert Comment

by:yuzh
ID: 11691160
why not just use:

<FilesMatch \.(?i:gif|jpe?g|png|htm?l|php)$>
 
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11692199
>  <FilesMatch "\.([^c][^s][^s][a-z0-9]?)$">
>  Should allow any 3-4 character extension and not allow .css

no.
does not allow .asa for example

I'd go with a white list as suggested by yuzh
0
 
LVL 16

Author Comment

by:hankknight
ID: 11694737
CrYpTiC_MauleR Said:
-----------------------------------------------------
               <Files ~ "\.([^c][^s][^s][a-z0-9]?)$">
               ForceType application/x-httpd-php
               </Files>
-----------------------------------------------------

Thanks!  This is what I needed.  I thought that the trouble was with my regular expressions but the problem was  because the images weren't being touched by PHP, the php_value auto_append_file command did nothing.

Now I need to evaluate the security implications of processing most filetypes as php scripts...
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to redirect request from IIS server to old Apache Server. 3 172
Problem to get function 52 122
maybe no no httpd.conf 6 88
Reverse Proxy problem 3 35
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question