Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some sites on a server. they all have a drectory named 'image-upload' where users of sites upload their images.

I want to:

  • Off PHP engine for this directory on all the sites

  • disable .htaccess on this directory on all the sites

Can I do it apache config file using regex?

share|improve this question
what is the reason of giving negative point to my question? – hd01 Jul 12 '13 at 13:34

You can set configuration options using a FilesMatch and DirectoryMatch directove which uses a globbing patter (not a regex). But you don't even need a glob: just using a Directory directive has the same effect.

The manual describes doing this via .htacess, in your httpd.conf....

<Directory "/var/www/html/image-upload">
   php_flag engine off
   AllowOverride None

(but adding a .htaccess file to disable the engine as well would be a good idea).

It would be a better idea to keep user uploads completely outside the document root and mediate all access via a proxy script.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.