Chapter 2. Preparing for Website Coding

File Name Rules

File Name Rules
Tag:

Having the right file names is important. Some characters may not be properly processed depending on the computing environment. To make sure that the file you create works properly on a web server, you need to follow file name guidelines.

File extension

.html is the extension for HTML files. The operating system and related software will recognize a file as an HTML file by this extension.

Characters you can use

Use a combination of the following characters:

  • Alphabets
  • Numbers
  • Hyphens
  • Underscores


If you need to use separators, you should use hyphens ( - ) or underscores ( _ ).

Characters you should not use

Spaces

You may be using spaces in file names when you use Mac OS or Windows OS; however, using spaces in file names in coding may lead to problems. If you want to add separators to file names, you should use hyphens ( - ) or underscores ( _ ).

Special characters

Some special characters are also prohibited such as < > ; ' " etc. Technically, there are special characters you can use; however, it is better to avoid using special characters, except hyphens ( - ) or underscores ( _ ), to avoid unexpected errors.

Lower case and upper case

Use lowercase only. Technically, you can use upper case characters; however, it is better to avoid using upper case. Mixing upper-case and lower-case characters can create potential confusion as case sensitivity depends on the computing environment.

Ideaindex.html

Typically, index.html is used for the top page of the website. Web servers handle the file named index.html as the default page even though this file name is not specified in the URL. For example, when you access http://example.com in your browser, the browser opens the index.html file of that website if the file exists.

Having the right file names is important. Some characters may not be properly processed depending on the computing environment. To make sure that the file you create works properly on a web server, you need to follow file name guidelines.

File extension

.html is the extension for HTML files. The operating system and related software will recognize a file as an HTML file by this extension.

Characters you can use

Use a combination of the following characters:

  • Alphabets
  • Numbers
  • Hyphens
  • Underscores


If you need to use separators, you should use hyphens ( - ) or underscores ( _ ).

Characters you should not use

Spaces

You may be using spaces in file names when you use Mac OS or Windows OS; however, using spaces in file names in coding may lead to problems. If you want to add separators to file names, you should use hyphens ( - ) or underscores ( _ ).

Special characters

Some special characters are also prohibited such as < > ; ' " etc. Technically, there are special characters you can use; however, it is better to avoid using special characters, except hyphens ( - ) or underscores ( _ ), to avoid unexpected errors.

Lower case and upper case

Use lowercase only. Technically, you can use upper case characters; however, it is better to avoid using upper case. Mixing upper-case and lower-case characters can create potential confusion as case sensitivity depends on the computing environment.

Ideaindex.html

Typically, index.html is used for the top page of the website. Web servers handle the file named index.html as the default page even though this file name is not specified in the URL. For example, when you access http://example.com in your browser, the browser opens the index.html file of that website if the file exists.

Tag: