4
Could someone explain me this Nives system to access folder in the use of languages like html,css and php (../)(.../)(./).?
4
Could someone explain me this Nives system to access folder in the use of languages like html,css and php (../)(.../)(./).?
11
In accordance with RFC 3986:
If the path begins with ../
or ./
then they will be removed from the prefix:
../a/b/c
→ a/b/c
If the path begins with /./
, /../
they will be exchanged for /
/./a/b/c
→ /a/b/c
Break up with /.
, /./
, /..
will remove the /.
and /..
:
/a/b/c/..
→ /a/b/c/
and /a/b/c/.
→ /a/b/c/
Break up with /./
and /../
will remove an item:
/a/b/c/../
→ /a/b/
If /../
is in the middle will remove the prefix (similar to explanation 4):
/a/b/../c/
→ /a/c/
If ./
be in the middle will have the same behavior as explanation 2:
/a/b/./c/
→ /a/b/c/
Some extra details on Dots and accents in mod_rewrite Urls
Of course the reading of RFC 3986 is something a little difficult, even for those who already have some experience, some of the examples made with tests, to summarize the ..
would be to move up a folder level (if not in the prefix) and the ./
would be to point out the site itself.
Imagine we have a folder with this structure:
./teste.html
./pasta
├── index.html
└── ./paginas
├── a.html
└── b.html
If in the /pasta/paginas/a.html
click on the link:
<a href="../index.html">teste</a>
It will direct to /pasta/index.html
But if the link is:
<a href="./index.html">teste</a>
Then he’ll try to find /pasta/paginas/index.html
, what in the example does not exist.
And if in /pasta/paginas/b.html
has:
<a href="../a.html">teste</a>
Go find something like /pasta/a.html
, what would be wrong in the example, should be:
<a href="./a.html">teste</a>
To stay on the same level /pasta/paginas/a.html
If you have a link like /teste.html
or /../teste.html
or /./teste.html
it will look for something in the root defined, in case the example will look for something like /a.html
for all the links cited, because the /
in the prefix moves to the root.
Of course this all depends on place as described, the same goes for CSS and even when it is used include
in PHP.
This nay is described in RFC, probably most applications like HTTP servers and browsers will interpret this as a file or as an inaccessible path, in Apache for example it sends a response HTTP 403 Forbidden and usually returns something like:
Forbidden
You don't have permission to access /.../ on this server.
Or how unseen
5
It is common for web pages to use relative Urls containing only a partial path and a file name.
In paths relative to the document, we use point-point-bar ../ to indicate that a level should be returned.
Examples:
1: To walk from the directory dirc to the directory dira:
../dira/nomeArquivo.ext
2: To walk from the directory dire to the directory dira
../../dira/nomeArquivo.ext
3: To walk from the directory dire to the directory Dirb
../../dirb/nomeArquivo.ext
./ same folder.
Thank you !!!!!!
Leo, just to warn you, I’m not the one who said no and I don’t know why, but if you want a tip, it would be nice to change this image for real text. Except for the folders, don’t think that all downvote is arbitrary, most may be a way of saying "you can get better". META read when you can: https://pt.meta.stackoverflow.com/search?q=downvote
Yes, but the folder image is good, just take the part that is text in the image and convert into real text. What seems cool to you is not always useful to other people the way you do, for example have a colleague here on the site that domain images .imgur.com
do not load, just like other image host domains, this because in his company has a proxy that blocks, another problem is that there are visually impaired people who apparently work in our area (IT), use screen readers, even if rare. As I said the folder image is usable.
Upvote has nothing to do with the situation, you must do this in order to help and not win something, you have to understand how I have explained to you other times, that something for you may seem: good, useful, functional or the best tool in the world. But for other users who access your answers it can be something impractical or inaccessible. The suggestions I always give you are for you to improve and your answers to be more useful for the "whole community", has nothing to do with "vote blackmail" or "exchange of votes".
3
../
can be read as a folder above.
Consider this structure:
dominio.com/html
dominio.com/images
Imagine a folder page /html
need to access an image of the folder /image
.
if you know the domain, will do something like
<img scr="http://www.dominio.com/image/image01.png">
And you’ll be happy until you need to use this code on another domain.
Is being made:
<img scr="../image/image01.png">
The page will understand where the image is. And if you want to reuse the code, or change the domain in the future, you can do it without difficulty. And you’ll be happy forever.
Note that you can nest folders by repeating the pattern. So ../../
means, two folders above, and so on.
./
refers to the same folder. In practice, it is redundant and unnecessary.
.../
I don’t know. I’ve never seen.
thank you !!!!!!
"./" = a folder above ".. /" = two folders above
Are you sure @Valdomiro?
Browser other questions tagged php html css
You are not signed in. Login or sign up in order to post.
RFC
efficient.– Edilson
@Edilson actually is only the "norms" that should be followed, each browser or server can implement as it pleases, but if it does not follow it is clear that it would make a number of systems fail.
– Guilherme Nascimento