Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

what is the rule for htaccess that makes all files text ?

like .php .py .pl whatever will be no different than .txt, source code should appear on the screen without execution.


share|improve this question
up vote 3 down vote accepted

ForceType text/plain

share|improve this answer

Create a rule in an .htaccess file in whatever directory you want to house your code examples. The .htaccess file should have this in it:

AddType application/x-httpd-php-source php

That's it. You'll get nice color coding. Jeff's answer works well for all file types.

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.