Tsohost Knowledge Base

How to run PHP scripts with a different file extension

Modified Monday 18th August, 2014 at 10:53

Was this helpful?

Sometimes you might want to execute PHP using a non-PHP file extension, for instance you might have an image handling script which you would like to be called imageHander.jpg instead of imageHandler.php.

To accomplish this, create a file called .htaccess in the same directory as the script. The filename must be exact and most text editors will allow you to save a file with this filename. If you already have a .htaccess file, you can edit it. Either way, add the line:

Code:

AddType application/x-httpd-php5 .jpg

This will allow .jpg files in that directory to execute as PHP.


PHPscriptsfileextension

Still can't find what you're looking for?

That's not a problem. Our 24/7 customer support team are friendly and waiting to help answer your questions. The easiest way to get in touch is to raise a support ticket; simply click the button below.

Open Support Ticket