Take the 2-minute tour ×  Last night I made some admin changes
to my webserver. I use php. The php processor failed after the
update and if someone went to my homepage, the php page would
simply download and show the proprietary code and password to
anyone visiting. So I was wondering if there is a way to prevent
any form of download for php files using .htaccess -- but still
allow for normal viewing of the files.  share|improve this
question add comment  3 Answers  up vote 5 down vote accepted  A
good pattern to follow during development is to use a minimal
initialization file, which invokes the actual application which
resides outside the webroot. That way only a minimal stub with
no critical information is exposed in a case like this.
Simplified example:      .htaccess   <- rewrites all requests to
index.php     index.php   <- invokes ../app/critical_code.php
(or other files as requested) share|improve this answer add
comment  The trouble here is that either .htaccess is serving
your files to the user or