Changing Default PHP Script File Extensions |
|
|
|
By default, file names ending in .php or .php3 are interpreted as php scripts. If you would like to use a different extension, create a ".htaccess" file in the directory containing your scripts and add a line like the following:
AddType application/x-httpd-php php php3 asp
This will cause .asp files to be interpreted as PHP scripts as well as .php and .php3 files. Any number of extensions may be listed.
If you would like to have files with any unrecognized extension, or no extension at all, interpreted as PHP scripts, then you will need to change the default file type by putting the following in a ".htaccess" file:
DefaultType application/x-httpd-php
Just keep in mind that using non-standard extensions may make things difficult if you move to a different, less flexible host later on. Also, needlessly running files through PHP, for example, all HTML files including those with no scripting, can make your pages load a little slower.
|