Markdown files open in browser #738
-
Hello, When I click on the Markdown files (README.md), it open in the browser (e.g. domain.com/README.md) instead of downloading the file. How can I make it download the file when clicking on? Thanks for your answers. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Directory Lister does not handle the way files are opened directly. This is handled in combination by the web server and the user's web browser. First and foremost ensure your server is configured to return the correct MIME type of files.
Additionally, the user's browser may be configured to handle all files of a given type in a specific fashion (i.e. open or download). Reference your browsers support page (e.g. Firefox, Chrome) for instructions on configuring this. |
Beta Was this translation helpful? Give feedback.
-
I had achieved this by adding the the following code into .htaccess (Apache server).
Is this a good way to achieve this? |
Beta Was this translation helpful? Give feedback.
Directory Lister does not handle the way files are opened directly. This is handled in combination by the web server and the user's web browser.
First and foremost ensure your server is configured to return the correct MIME type of files.
AddType
directive (part ofmod_mime
)types
configuration option (usually found in themime.types
file)Additionally, the user's browser may be configured to handle all files of a given type in a specific fashion (i.e. open or download). Reference your browsers support page (e.g. Firefox, Chrome) for instructions on configuring this.