Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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.