Newb
Newb

Reputation: 2930

How can I display an Ascii File in a Web Browser?

I have a website. I have uploaded some .c and .py files to my website. Now, if I have a .txt file, then I can open it directly in a new tab in the browser. However, to view my .c and .py files, which are in ASCII format, I have to download them and use a local text-editor to view them. This seems impractical.

How can I view the plaintext of my .c and .py files in the browser? Is this something I can configure on the web-end, or is this an option I have to set in my browser?

Upvotes: 0

Views: 1438

Answers (1)

kuldeep.kamboj
kuldeep.kamboj

Reputation: 2606

If you have access of your web server (in case of apache web server) settings, Then you can do it.

Put following lines in apache2.conf (Ubuntu/Debian) / httpd.conf (Redhat/Fedora)

AddType text/plain .c
AddType text/plain .py

and restart the web server

Upvotes: 1

Related Questions