Welcome to WebmasterWorld Guest from 18.104.22.168
AddType text/plain .cgi .py .tmpl
But there are also some files without a *.py or *.cgi ending like htaccess. How can i display those files as text/plain?
'.htaccess' is basically special, if chown'ing, chgrp'ing and chmod'ing it as openly as possible doesn't work, as it shouldn't, then you might find that you need to change it's name to 'htaccess.txt' and write the explanation in it, ie;
# the proper name of this file in a Linux (Google: LAMP) setup is .htaccess
# but Apache won't show it to you with it's right name, not even in a subdirectory.
I'm pretty sure Apache won't display the contents of any file named '.htaccess' no matter who owns it or how 777 it's MOD is but if anyone knows better I'd appreciate them trumping me just to be corrected alone.
If I wanted to show everybody the contents of my 'special' files, I would be inclined to mark them up into suitable HTML to provide navigation surrounding the <code></code> sections and not actually try to expose files of those extensions 'using their own extensions' so to speak.
file foo --> renamed to --> foo.txt
RewriteRule ^foo$ /foo.txt [L]
The URL is still example.com/foo, but the filename is now foo.txt. Since MIME-types are set according to the filetype and not the URL, a request for example.com/foo will now return a proper Content-Type: text/plain response header.
By the way, .htaccess is its own extension; It doesn't have a filename. :)