tags:

views:

23

answers:

2

I am looking to host a ".exe" file for our clients to download and i wanted to place it at "www.example.com/file". i have created a .htaccess route from "/file" to the location of the program but when you go there the browser doesnt know what file extension to use.

Is it possible to slip the file extension in there?

A: 

You need to set the mimetype, and then, it depends on the browser if it changes the extension or not. Some developers use an iframe with the file, with extenstion, to hide the ugly url.

There is a big change apache already sets the mimetype.

According to this site, the mimetype should be one of the following: application/octet-stream application/x-msdownload application/exe application/x-exe application/dos-exe vms/exe application/x-winexe application/msdos-windows application/x-msdos-program

Dykam
+1  A: 

The simplest way would be to use .htaccess to forward the browser to the .exe file.

RewriteRule /file /file.exe [R,L]

If you really want to keep it hidden for some reason then you'd have to write a script to output a Content-disposition header:

Content-disposition: attachment; filename=file.exe
Greg