How to change your server config so that files without an extension serves as plain text?

I have uploaded a file without any file extension. I want it to be displayed in the web browser as plain text rather than inside HTML markups. Also, I don’t want to add any file extension.

If you tried it already and it’s don’t want to go as you want — think about using mod_rewrite if you just want to have url without extension, better say all of your idea so you’d receive best solution, instead of trying doing it with your complicated way.

I want that when we inspect the text in the web browser then instead of displaying it inside HTML tags it just shows the text inside the file.

The default mime type on our server is HTML. So any unknown (text) files would be returned as HTML. There are ways to override content types, by using:

  • .htaccess rules, but I believe custom content types need to be set on extensions.
  • PHP code, but that would require the file to have the .php extension.

So I’m not sure it’s possible to do what you want here. Maybe someone else knows.