Apache Handlers, running html as php

Apache handlers allow you to control what Apache will do with certain file types. When Apache sees a file, it has an action built in for that file type, and will perform that action.

If you wish Apache to do a different action, you will need to make a handler to tell Apache to perform that action. For example, if you use a file type that requires a special service to run it, such as a file with server side includes that is not named with a .shtml extension, you need to tell Apache to treat these files differently.


To get regular html pages to handle php code, you need to add this line to yourhtaccess file.
AddHandler application/x-httpd-php5 .html .htm
It is highly recommended that you never allow html pages to automatically handle php or shtml, because this forces all of your html pages to be processed by the server first. Instead, please rename your files to .php or .shtml whenever possible.

System Mime Type defaults

Handler CodeFile Extensions
application/x-hdfhdf
application/vnd.wap.wbxmlwbxml
image/x-xbitmapxbm
image/x-iconico
image/vnd.djvudjvu djv
application/x-troff-meme
application/perlpl plx ppl perl pm
application/x-tcltcl
image/bmpbmp
text/x-sqlsql
image/pngpng
text/x-loglog
audio/x-realaudiora
application/x-latexlatex
application/x-directordcr dir dxr
text/rtfrtf
application/xhtml+xmlxhtml xht
application/vnd.ms-powerpointppt
application/x-cshcsh
image/svg+xmlsvg
application/x-troff-msms
image/x-rgbrgb
application/x-imgimg
image/jpegjpeg jpg jpe
image/x-portable-pixmapppm
text/plainasc txt
image/cgmcgm
application/x-shsh
application/andrew-insetez
application/vnd.wap.wmlscriptcwmlsc
text/x-registryreg
video/vnd.mpegurlmxu
image/iefief
audio/x-pn-realaudioram rm
image/x-xpixmapxpm
video/mpegmpeg mpg mpe
text/tab-separated-valuestsv
application/rdf+xmlrdf
application/x-httpd-phpphtml php php3 php4 php5 php6
x-conference/x-cooltalkice
image/tifftiff tif
text/richtextrtx
text/csscss
application/rubyrb
application/x-wais-sourcesrc
application/xmlxml xsl
application/voicexml+xmlvxml
image/x-portable-graymappgm
chemical/x-xyzxyz
model/igesigs iges
application/vnd.mifmif
application/mathml+xmlmathml
application/x-ustarustar
application/x-troff-manman
text/vbscriptvbs
text/calendarics ifb
chemical/x-pdbpdb
application/smilsmi smil
application/srgs+xmlgrxml
image/x-portable-anymappnm
application/x-shockwave-flashswf
audio/mpegmpga mp2 mp3
video/x-sgi-moviemovie
application/cgicgi
application/x-cpiocpio
application/x-javascriptjs
text/x-setextetx
audio/basicau snd
text/sgmlsgml sgm
application/x-tartgz tar
application/vnd.mozilla.xul+xmlxul
application/x-futuresplashspl
application/xslt+xmlxslt
model/meshmsh mesh silo
application/mac-binhex40hqx
text/vnd.wap.wmlwml
image/x-cmu-rasterras
application/x-sv4cpiosv4cpio
audio/x-aiffaif aiff aifc
application/x-gtargtar
audio/x-ms-waxwax
audio/x-ms-wmawma
image/x-xwindowdumpxwd
application/x-cdlinkvcd
application/msworddoc
video/quicktimeqt mov
application/x-bcpiobcpio
application/x-textex
text/x-configcnf conf
application/x-sv4crcsv4crc
application/x-dvidvi
application/x-trofft tr roff
audio/x-mpegurlm3u
application/x-sharshar
audio/mp4a-latm m4p m4a mp4
application/pdfpdf
application/mac-compactprocpt
application/vnd.wap.wmlcwmlc
video/x-msvideoavi
application/oggogg
text/htmlhtml htm shtml
image/gifgif
audio/midimid midi kar
application/x-pkcs7-crlcrl
application/x-chess-pgnpgn
audio/x-pn-realaudio-pluginrpm
application/srgsgram
application/x-koanskp skd skt skm
image/vnd.wap.wbmpwbmp
application/x-netcdfnc cdf
model/vrmlwrl vrml
application/x-httpd-php-sourcephps
application/vnd.ms-excelxls
application/postscriptai eps ps
application/x-texinfotexinfo texi
application/zipzip
image/x-portable-bitmappbm
audio/x-wavwav
application/x-x509-ca-certcrt
application/odaoda
application/xml-dtddtd
application/octet-streambin dms lha lzh exe class so dll iso dmg
text/vnd.wap.wmlscriptwmls
application/x-stuffitsit
  • 0 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

How to Connect to the MySQL Database

Note: If connecting from your home computer, you need a MySQL client like Navicat,...

How to log into cPanel

cPanel is used for managing your web hosting account and available on all Microhosting Linux...

Please read before creating an Addon Domain

About addon domainsAddon Domains are handled like subdomains as far as the server is concerned,...

How to generate/download a full backup

A full backup is a backup of all of your files, e-mail, databases, etc. To run a full backup, you...

How to change the password of your cPanel account

There may be times where you would like to change the password of your account. It is...