htmlurlfilenamesfile-extensionrelative-url

Is a file name with its file extension (without the path) considered a URL?


I was wondering if index.html is a relative URL or not.

I know that Website/Pages/index.html is a URL. But what if it was just the file name and file extension without the path? Would it still be called a URL?


Solution

  • What a path relative URL is

    And, yes, index.html can be a relative url.

    When referring to a file that occurs in the same directory as the referring page, a URL can be as simple as the name of the file

    If you want to link to your index.html page from your about.html page, as long as they're in the same directory you could very simply do:

    <a href="index.html">Index</a>
    

    What i think you are confusing is absolute vs relative paths. As other's are describing, a URL with an absolute path needs to be defined by:

    1. protocol: (http://)
    2. domain: (bobsjingles.)
    3. extension: (edu)
    4. directory path: (/journeycovers)
    5. fragment: (/index.html)

    http://bobsjingles.edu/journeycovers/index.html

    All that absolute path does (essentially) is point to an IP / port on a machine, where you can send a request under a specific protocol (http), and get an expected data result (html.)