Change folder
Solved
mellissa
Posted messages
4
Status
Member
-
lami20j Posted messages 21506 Registration date Status Moderator, Security Contributor Last intervention -
lami20j Posted messages 21506 Registration date Status Moderator, Security Contributor Last intervention -
<a href="../index.html"> cela te permettra de revenir à la page principale en français depuis le dossier anglais.
Tu utilises ".." pour indiquer que tu veux remonter d'un dossier.
Donc, dans ta page en anglais, tu peux écrire : <a href="../en/index.html"> pour aller à la page en anglais à partir de la page en français, ou revenir à la page principale.
Si tu as d'autres questions, n'hésite pas !
5 answers
-
The current directory is a point, for example, with the path to truc.html in the current folder:
"./truc.html" is equivalent to "truc.html"
To reach truc.html in the parent directory:
"../truc.html"
To reach truc.html in the parent of the parent directory:
"../../truc.html"
To reach truc.html at the root of the site (the parent of all others):
"/truc.html"-
Thank you for responding, but I'm still stuck.
So, I have:
http://www.my site.com, and within that, I have an English folder that I open
with a link:
<a href="an/index.html">: no problem here,
now when I’m in the English folder, to return to the French folder:
<a href="/index.html">, it doesn’t work.
<a href="/my site/index.html">, it doesn’t work
I have to write:
<a href="http://www.my site.com">
it’s probably not complicated, but I can’t figure it out!!
Thank you for helping me. -
-
-
Hi,
I don't quite understand. Do you want to go back in the hierarchy, meaning go to the parent folder?
In that case, you just need to use relative links:
<a href="../index.html">
I recommend reading this page, it will be really useful for understanding relative and absolute paths:
https://www.commentcamarche.net/contents/1091-repertoire -
Hello,
site_mother contains:
index.html
in
esp
To go to English
en/index.html
To return
../index.html
To go to esp
.. to go back to the parent folder (site_mother)
in to go to Spanish
so:
../esp/index.html
Read carefully the answer 2 from Kilian.
You need to juggle with . and ..
. current directory .. parent directory
If you have this structure:/parent/child1/child11/child12/index1.html /parent/child2/child21/child22/index2.html
and you are on index2.html here’s how to link to index1.html step by step:
You must go back up to /parent to be able to change the children
- the current directory is child22./index2.html
- the parent directory for child22 and child21 so to access child21 you write../
you go back one directory
- the parent directory for child21 and child2 so to access child2 you write../../
you go back two directories
- the parent directory for child2 and parent so to access parent you write../../../
you go back three directories
and now since you are in parent you have access to all the children
So to enter child12/index1.html you follow the other path../../../child1/child11/child12/index1.html
In short, since we were in index2.html we had to go back 3 directories and then go down 3 directories to access index1.html.
Take the simple algorithm:
A->B->C
A->B1->C1
You are in C1. To get to C you must do it via A, so we have
C1 ->B1 ->A ->B ->C
../../B/C -
Thank you for this explanation, actually it’s quite simple....now.
Well, I was thinking of getting into PHP, but I think I’ll do some cooking instead!!!
Thanks again. -
ok thanks,
I forgot the colons and now it's good, but since I'm useless, I can't switch files to the other: if I have two folders in my main folder, for example: English and Spanish: to switch from English to French:
<a href="../index.html">,
but to go from English to Spanish?
and please nobody laugh at me!!!