i want to make users to be able to upload PHP files and download them without executing them,
i need to turn off PHP for a specific directory so it behaves as plain text.
i tried this but is it a proper solution ?
RemoveHandler .php .phtml .php3
RemoveType .php .phtml .php3
php_flag engine off
You can use a Proxy Script to handle this.
In your
.htaccessfile, you can redirect all the requests in the folder to change to this way:To
Source of
.htaccessAnd in the
index.phpjust parse the file and give the output.Source of
index.php:Fiddle: http://codepad.viper-7.com/68FSIU
Note: You need to sanitize the inputs before you allow URLs to pass. So, people might inject
../, etc. those should be taken care.Hope this helps and it is perfectly fine.