sonjoyray Posted January 10, 2021 Share Posted January 10, 2021 Please I need help about relative path. I am confusing this relative file path. I understood other relative path but this relative path very confusing I feel. I need clear concept of this relative path. Link to comment Share on other sites More sharing options...
dsonesuk Posted January 10, 2021 Share Posted January 10, 2021 The first slash usually represents the root directory or domain name that is directed to that directory, images is a folder within that root directory and then the image within that images folder. 1 Link to comment Share on other sites More sharing options...
lokudolem Posted January 11, 2021 Share Posted January 11, 2021 The first slash is directory root for more subfolders before images folder. 1 Link to comment Share on other sites More sharing options...
melahi Posted January 29, 2021 Share Posted January 29, 2021 On 1/12/2021 at 7:30 AM, lokudolem said: The first slash is directory root for more subfolders before images folder. It's the http root which is not the same as your file system root. This is because you don't want to put your entire file system online. It is configurable on your file server. And the first part of the URL is handled by a DNS lookup, so that vistor to your site are directed to your computer at whatever IP address it has been registered. So say you are using Apache on a server running Linux then there will be a file called /etc/httpd/conf/httpd.conf In that (text) file will be a line saying something like: DocumentRoot "/srv/http" The actual file that visitors access thus will be /srv/http/images/picture.jpg but your web pages can reference them as /images/picture.jpg 1 Link to comment Share on other sites More sharing options...
sonjoyray Posted January 29, 2021 Author Share Posted January 29, 2021 1 hour ago, melahi said: It's the http root which is not the same as your file system root. This is because you don't want to put your entire file system online. It is configurable on your file server. And the first part of the URL is handled by a DNS lookup, so that vistor to your site are directed to your computer at whatever IP address it has been registered. So say you are using Apache on a server running Linux then there will be a file called /etc/httpd/conf/httpd.conf In that (text) file will be a line saying something like: DocumentRoot "/srv/http" The actual file that visitors access thus will be /srv/http/images/picture.jpg but your web pages can reference them as /images/picture.jpg Thank you very much. I try to find a solution to this in many places. But I did not get the right decision. In the end I think it must be related to the server that got the solution in your answer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now