What are common file extensions for web programmin

2020-02-17 09:34发布

问题:

What file extensions are used most commonly by different languages? Please don't put source file names (like .java) but rather extensions that would be present in a URL for rendered pages.

Here is my (alphabetized) list so far

  • ASP Classic
    • asp
  • ASP.NET
    • aspx
    • axd
    • asx
    • asmx
    • ashx
  • CSS
    • css
  • Coldfusion
    • cfm
  • Erlang
    • yaws
  • Flash
    • swf
  • HTML
    • html
    • htm
    • xhtml
    • jhtml
  • Java
    • jsp
    • jspx
    • wss
    • do
    • action
  • JavaScript
    • js
  • Perl
    • pl
  • PHP
    • php
    • php4
    • php3
    • phtml
  • Python
    • py
  • Ruby
    • rb
    • rhtml
  • SSI
    • shtml
  • XML
    • xml
    • rss
    • svg
  • Other (C, perl etc.)
    • cgi
    • dll

Any more? I'll keep updating this based on comments. Largest correct additions (or deletions) is the accepted answer.

Aside: This is for comparing language use online: http://blog.paulisageek.com/2009/10/file-extensions-on-internet.html

回答1:

Add there:

  • ASP.NET
    • .axd
    • .asx
    • .asmx
    • .ashx
    • .aspx


回答2:

Keep in mind that good URL design will completely hide any underlying file types.



回答3:

I have created a Github gist that contains a list of programming languages and their extensions, here is a subset of the data included in the gist file:

{
  "name":"CoffeeScript",
  "type":"programming",
  "extensions":[
     ".coffee",
     "._coffee",
     ".cake",
     ".cjsx",
     ".cson",
     ".iced"
   ]
  },{
  "name":"ColdFusion",
  "type":"programming",
  "extensions":[
     ".cfm",
     ".cfml"
  ]}

I hope it is helpful.

languages.json.



回答4:

.action -- struts2

.do -- struts1

.xml -- XML

.rss -- RSS feeds

.atom -- Atom feeds(RSS)

(no extension) -- used now a days to increase readability of the URL, check stackoverflow URL



回答5:

.yaws (Erlang Yaws Web Server)



回答6:

.js, .html, .htm, .xhtml probably deserve a nod.



回答7:

.aspx .asp .css



回答8:

AOLServer using Tcl - .adp



回答9:

REBOL tends to use .r

But .cgi is also used by some for REBOL CGI scripts.



回答10:

ASP.NET needs a couple more, but I'm not sure this is exhaustive:

  • aspx
  • ascx
  • asmx (web services)


回答11:

Here's a few of the commonly-used (but rarely enforced) extensions for some CSS dialects:

  • .hss for hss style sheets
  • .sass for sass style sheets
  • .less for less css style sheets
  • .ccss or .pcss for clever css style sheets


回答12:

Ruby also tended to use .rhtml in the past.

Stellent uses the .hcsp extension for its page templates.

I believe Django uses .dtl.



回答13:

Going old school: .cgi

Typically written in C or Perl



回答14:

Ruby on Rails also uses the following internally for templates (files that are mostly HTML or JavaScript). So they're not really public facing, and are transparent to the end user/robot.

  • .html.erb
  • .erb
  • .rjs

Used to be that most CGI scripts were written in Perl.



回答15:

.java .cs and .i_am_kidding_i_read_the_question.

On the serious side, swf (Flash) get hidden by the JS that loads them, generally, but they are extensions usually seen by the client. This is a limit case because it's not like JPEG (doesn't allow for web programming) nor like Javascript. But then, neither is PHP/ASP/JSP because from the client side it's just markup :)



回答16:

IE specific strangeness:

  • .hta -- html application
  • .htc -- html components, allows you to alter IE behavior at runtime, from you website!

Also XML:

  • .svg -- it's not just an image format!


回答17:

.json has become popular as a data xfer format

.png .jpg .gif are the most common graphics, but there are others.

Also video extensions



回答18:

-SSI (Server Side Includes), use the extension .shtml