Categories
.htaccess apache javascript php

Tell Apache whether or not to execute PHP on requests

I am using PHP with Apache and wonder if there is a way to indicate from the client side that the requested PHP file shouldn’t be executed/parsed. By standard, I want all PHP files to be executed when requested, but I want a way to indicate from the client side that the file should not be executed.

A nice solution would be to supply an extra header in the request using JavaScript and then write some code in a .htaccess file to check if the header is present, and if it is tell apache to not execute the file and just serve it as text.

Using GET parameters or something else would also be okay.

Is this possible? If so, how?