Path for index page

The INDEX_PATH expression matches the following paths:

  • /
  • /index.htm
  • /index.html

The expression that fits these paths is "^/(index\.html?)?$".

The ^ symbol means there must be a string beginning, while the $ symbol means there must be a string ending. When we place these symbols on either side, we prevent all prefixes and suffixes in the path and expect exact matching.

The ( ) brackets implies there must be a group. An expression in a group is treated as an indivisible unit.

The ? symbol means that the previous character is optional. We place it after the l character to allow the file in the path to have both .htm and .html extensions. As you'll see later, we don't have an index file to read. We use it as an alias of the root path handler. The question mark is also used after a whole group with a file name to fit the empty root path, /.

The  dot symbol (.) fits any character, but we need a real dot symbol. To treat a dot as a symbol, we have to add a backslash (before it. A single backslash, however, will be interpreted as a beginning-of-escape expression, so we have to use pair of backslashes (\) to make the backslash a plain symbol.

All other characters are treated as is, including the / symbol.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.68