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

On an Apache host, I have a folder called /thumbs with a program in it called program.php that I will use to create thumbnails.

There is a .htaccess file that contains the following lines:

options -indexes
errordocument 404 program.php

What should happen is that when I call /thumbs/image1.jpg, program.php should be executed.

What actually happens is that the browser just echoes the name of the program. Calling /thumbs/image1.jpg results in the browser showing:


and no code is executed.

I have used this technique on many other sites and it has worked, but not this time.

Anybody know why this might be the case?

share|improve this question
up vote 4 down vote accepted

The ErrorDocument directive can be used several ways, depending on the syntax. To execute a file the way you want, you must use the full path relative to the DocumentRoot, preceded with a /. Otherwise, it's taken to be a literal message to be displayed, which is what is happening for you.

Try this:

 ErrorDocument 404 /thumbs/program.php

More info here:

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.