PHP, MySQL, Drupal, .htaccess, Robots.txt, Phponwebsites: AddType
AddType - phponwebsites.com
Showing posts with label AddType. Show all posts

22 Nov 2013

How to force script to display as source code using .htaccess

                       You can display script code as a source code instead of executing.
Syntax:
             RemoveHandler cgi-script .pl .cgi .php .py
             AddType text/plain .pl .cgi .php .py

Explanation:
             where,
                        RemoveHandler - remove all the server-parsed handler associated with the extensions like .pl, .php for all the paths.
                        .cgi - run outside of /cgi-bin/ directory
                        .py -  treat same as a normal HTML file
                        AddType - used to assign a MIME type to a file suffix
                        text/plain - format of file.

Related Post:

20 Nov 2013

How to add MIME types using .htaccess

                      MIME expands  Multi-purpose Internet Mail Extensions. It is used to classify the file types on Internet.
                     Sometimes, the browser can not understand the file types of a file. At that time, we can instructs to browser, what file type is? using .htaccess. We can also create custom file type using it.
Syntax:
            AddType text/plain .txt
            where,
                        AddType - means that you are adding a new file type to MIME types.
                        text/plain  - MIME type
                                .txt   - extensions
Example:
                 AddType application/pdf .pf
                 AddType application/zip .zip
                 AddType image/jpeg .jpg .jpeg

Most Common MIME Types:

           

     .3dm                - x-world/x-3dmf
      .3dmf               - x-world/x-3dmf
      .a                     - application/octet-stream
      .aab                 - application/x-authorware-bin
      .aam                - application/x-authorware-map
      .aas                 - application/x-authorware-seg
      .abc                 - text/vnd.abc
      .acgi                - text/html
      .afl                   - viedo/animaflex
      .aif                  - audio/aiff
      .aif                  - audio/x-aiff
      .aifc                 - audio/aiff
      .aif                  - audio/x-aiff
      .aiff                  - audio/aiff
      .aiff                  - audio/x-aiff
      .aim                  - application/x-aim
      .aip                  - text/x-audiosoft-intra
      .ani                  - application/x-navi-animation
      .aos                  - application/x-nokia-9000-communicator-add-on-software
      .aps                  - application/mime
      .arc                  - application/octet-stream
      .arj                  - application/arj
      .arj                  - application/octet-stream
      .art                  - image/x-jg
      .asf                  - video/x-ms-asf
      .asm                - text/x-asm
      .asp                  - text/asp
      .asx                  - application/x-mplayer2
      .asx                  - video/x-ms-asf
      .asx                  - video/x-ms-asf-plugin
      .au                  - audio/basic
      .au                  - audio/x-au
      .avi                 - application/x-troff-msvideo
      .avi                 - video/avi
      .avi                 - video/msvideo
      .avi                 - video/x-msvideo
      .avs                 - video/avs-video
      .bcpio             - application/x-bcpio
      .bin                 - application/mac-bimary
      .bin                 - application/macbinary
      .bin                 - application/octet-stream
      .bin                 - application/x-binary
      .bin                 - application/x-macbinary
      .bm                 - image/bmp
      .bmp               - image/bmp
      .bmp               - image/x-windows-bmp
      .boo                - application/book
      .book              - application/book
      .boz                 - application/x-bzip2
      .bsh                 - application/x-bsh
      .bz                   - application/x-bzip
      .bz2                 - application/x-bzip2
      .c                     - text/plain
      .c                     - text/x-c
      .c++                - text/plain
      .cat                  - application/vnd.ms-pki.seccat
      .cc                   - text/plain
      .cc                   - text/x-c
      .ccad               - application/clariscad
      .cco                 - application/x-cocoa
      .cdf                  - application/cdf
      .cdf                  - application/x-cdf
      .cdf                  - application/x-netcdf
      .cer                  - application/pkix-cert
      .cer                  - application/x-x509-ca-cert
      .cha                  - application/x-chat
      .chat                 - application/x-chat
      .class                - application/java
      .class                - application/java-byte-code
      .class                - application/x-java-class
      .com                 - application/octet-stream
      .com                 - text/plain
      .conf                 - text/plain
      .cpio                 - application/x-cpio
      .cpp                  - text/x-c
      .cpt                   - application/mac-compactpro
      .cpt                   - application/x-compactpro
      .cpt                   - application/x-cpt
      .crl                    - application/pkcs-crl
      .crl                    - application/pkix-crl
      .crt                    - application/pkix-cert
      .crt                    - application/x-x509-ca-cert
      .crt                    - application/x-x509-user-cert
      .csh                   - application/x-csh
      .csh                   - text/x-script.csh
      .css                   - application/x-pointplus
      .css                   - text/css
      .cxx                   - text/plain
      .dcr                   - application/x-director
      .deepv               - application/x-deepv
      .def                   - text/plani
      .der                   - application/x-x509-ca-cert
      .dif                    - video/x-dv
      .dir                    - application/x-director
      .dl                     - video/dl
      .dl                     - video/x-dl
      .doc                  - application/msword
      .dot                  - application/msword
      .dp                   - application/commonground
      .drw                 - application/drafting
      .dump              - application/octet-stream
      .dv                   - video/x-dv
      .dvi                  - application/x-dvi
      .dwf                 - drawing/x-dwf (old)
      .dwf                 - model/vnd.dwf
      .dwg                - application/acad
      .dwg                - image/vnd.dwg
      .dwg                - image/x-dwg
      .dxf                  - application/dxf
      .dxf                  - image/vnd.dwg
      .dxf                  - image/x-dwg
      .dxr                  - application/x-director
      .el                    - text/x-script.elisp
      .elc                  - application/x-bytecode.elisp
      .elc                  - application/x-elc
      .env                 - application/x-envoy
      .eps                 - application/postscript
      .es                   - application/x-esrehber
      .etx                  - text/x-setext
      .evy                 - application/envoy
      .evy                 - application/x-envoy
      .exe                 - application/octet-stream
      .f                     - text/plain
      .gif                  - image/gif
      .gl                   - video/gl
      .gsm               - audio/x-gsm
      .gz                  - application/x-compressed
      .gz                  - application/x-gzip
      .gzip               - application/x-gzip
      .gzip               - multipart/x-gzip
      .htc                 - text/x-component
      .htm                - text/html
      .html               - text/html
      .htmls              - text/html
      .htx                 - text/html
      .ico                 - image/x-icon
      .ima                - application/x-ima
      .imap              - aplication/x-httpd-imap
      .jav                 - text/x-java-source
      .java               - text/plain
      .java               - text/x-java-source
      .jpe                 - image/jpeg
      .jpe                 - image/pjpeg
      .jpeg                 - image/jpeg
      .jpeg                 - image/pjpeg
      .jpg                 - image/jpeg
      .jpg                 - image/pjpeg
      .js                   - application/x-javascript
      .js                   - application/javascript
      .js                   - text/javascript
      .ksh                - application/x-ksh
      .list                 - text/plain
      .m1v              - video/mpeg
      .m2a              - audio/mpeg
      .m3u              - audio/x-mpequrl
      .mht               - message/rfc822
      .mhtml           - message/rfc822
      .mif               - application/x-iframe
      .mif               - application/x-mif
      .mime            - message/rfc822
      .mime            - www/mime
      .mod             - audio/mod
      .mod             - audio/x-mod
      .movie           - video/x-sgi-movie
      .mp2              - audio/mpeg
      .mp2              - audio/x-mpeg
      .mp2              - video/mpeg
      .mp2              - video/x-mpeg
      .mp2              - video/x-mpeg2a
      .mp3              - audio/mpeg3
      .mp3              - audio/x-mpeg3
      .mp3              - video/mpeg
      .mp3              - video/x-mpeg
      .nif                 - image/x-niff
      .niff                 - image/x-niff
      .omc               - application/x-omc
      .omcd             - application/x-omcdatemaker
      .omcr              - application/x-omcregerator
      .part                - application/pro-eng
      .pas                 - text/pascal
      .pic                  - image/pict
      .pict                 - image/pict
      .png                 - image/png
      .ppm                - image/x-portable-pixmap
      .pps                  - application/mspowerpoint
      .ppt                  - application/powerpoint
      .qcp                 - audio/vnd.qcelp
      .rpm                 - audio/x-pn-realaudio-plugin
      .rt                     - text/richtext
      .rtf                    - application/rtf
      .sdp                  - application/sdp
      .sgm                  - text/sgml
      .sgm                  - text/x-sgml
      .sgml                 - text/sgml
      .sgml                 - text/x-sgml
      .shtml                - text/html
      .spr                   - application/x-sprite
      .sprite               - application/x-sprite
      .src                   - application/x-wais-source
      .swf                  - application/x-shockwave-flash
      .tex                   - application/x-tex
      .texi                  - application/x-texinfo
      .texinfo             - application/x-texinfo
      .text                  - application/plain
      .text                  - text/plain
      .txt                    - text/plain
      .unv                  - application/i-deas
      .vcd                  - application/x-cdlink
      .voc                  - audio/voc
      .vos                  - video/vosaic
      .wav                 - audio/wav
      .wav                 - audio/x-wav
      .wmf                 - windows/metafile
      .wpd                 - application/wordperfect
      .wsc                  - text/scriplet
      .xl                      - application/excel
      .xla                    - application/excel
      .xla                    - application/x-excel
      .xla                    - application/x-msexcel
      .xlb                    - application/excel
      .xm                    - application/xml
      .z                       - application/x-compress
      .z                       - application/x-compressed
      .zip                    - application/x-compressed
      .zip                    - application/x-zip-compressed
      .zip                    - application/zip
      .zip                    - application/x-zip

Related Post: