×
Jinxia Li

URL VS File Path

No Comments
  1. URL – 1) for ‘client’ to identify the location of a resource on a ‘server’. 2) Each URL is independent, it doesn’t know the existence of other URL
  2. file_path: for one file to talk to another file 2) file path is relative


URL = HTTP + host + absolute_file_path + file_name + ?query_key=query_value


1> absolute_file_path: for the ‘client’ to find the file on a ‘server’;
2> relative_file_path: for files to talk to one another on the ‘server’, you have to provide file path between them ,so one file know where another one is.

When the client make a request to the resource that referred by one file, it will 1) first calculate the absolute path based on the referring file, and 2) then append the absolute file path to ‘host’ in the URL. 3) Last, use the URL to make a HTTP request to the server.


Folder Structure

Request URL of the referring file

Relative path in <img src=””> ( in index.php)

Request URL of the referred image

Leave a Comment

Your email address will not be published. Required fields are marked *

By commenting you accept the Privacy Policy