Script for opening a file

How to implement this, I do not understand. If anyone knows, tell plz. , very interesting.

Answer 1, Authority 100%

apache mor_rewrite (write a rule so that, for example, “rewritten” page of the http view page: //localhost/page/name.ext in http: //localhost/page.php? File = Name.Ext) + Single script which and will install the necessary header and actually give the necessary data … about the “transformed” is not entirely clear …
By the way, as far as I know, when you open the Plain / Text text file, it is installed automatically in place, frankly – I don’t quite understand why all this is necessary, but if necessary, I described the algorithm above