“The file is there, so why does the link fail?” Often the missing piece is the starting location. A relative path is resolved against the current document's location. Let us finish the opening section by testing that in a small site.
Keep this folder structure
ilk-sitem/
index.html
hakkimda.html
gorseller/
notlar.svg
This is a diagram of files, not a terminal command. The two HTML files are neighbors, and the image is one folder below them. Preserve that arrangement when opening the examples.
Build the home page
Use the document skeleton from lesson three and place this content inside body:
<h1>Not Defteri</h1>
<p>Web öğrenirken tuttuğum notlar.</p>
<ul>
<li><a href="hakkimda.html">Hakkımda</a></li>
<li><a href="#dersler">Ders notları</a></li>
</ul>
<img src="gorseller/notlar.svg"
alt="Açık defterin sol sayfasında üç not satırı"
width="640" height="420">
<h2 id="dersler">Ders notları</h2>
<ol>
<li>HTML dosyası oluşturdum.</li>
<li>Bağlantı ve görsel ekledim.</li>
</ol>
No new element is introduced here. We combine headings, paragraphs, lists, links and an image. hakkimda.html looks in the current folder, gorseller/notlar.svg enters a child folder, and #dersler targets an identifier inside the current document.
Supply a route back
Create a complete document for hakkimda.html, give it its own title, and use this body:
<h1>Hakkımda</h1>
<p>Merhaba, ben Ali. Web geliştirmeyi öğreniyorum.</p>
<p><a href="index.html">Ana sayfaya dön</a></p>
Visit the About page from the home page, then use the page's own return link. This checks both directions rather than relying on the browser's Back button.
Move one file
For a temporary experiment, create a sayfalar folder and move the About file into it. The home-page link must become sayfalar/hakkimda.html. From the moved page, returning to the home page now requires going up one folder:
<a href="../index.html">Ana sayfaya dön</a>
<img src="../gorseller/notlar.svg" alt="Açık not defteri" width="640" height="420">
../ means one parent folder. The target's name has not changed; its route from the starting page has. After the experiment, move the file back and restore the original paths. Later examples use the initial structure.
Resolve paths from an explicit starting file
| Starting document | Target | Relative reference |
|---|---|---|
| index.html | hakkimda.html | hakkimda.html |
| index.html | sayfalar/hakkimda.html | sayfalar/hakkimda.html |
| sayfalar/hakkimda.html | index.html | ../index.html |
| sayfalar/hakkimda.html | gorseller/notlar.svg | ../gorseller/notlar.svg |
Read the table as a walk: begin in the document's directory, go up if necessary, then enter the target's directory. Start from the containing folder, not from the HTML filename as though it were another directory.
A leading slash changes the starting point
On a website, /gorseller/notlar.svg normally starts from the site's origin root rather than the current document directory. Under file:// it does not automatically mean your project folder. That is why our local examples begin with relative references.
If a site later lives under a subdirectory, root-relative paths can bypass that subdirectory. Working locally does not prove a path has the same meaning in the eventual publishing layout.
Three checks after moving a page
Moving About can affect the link to it, its return link and its own image references independently. Fixing the first does not establish that the other two work. A missing image resource and a failed document navigation are separate failures.
The package supplies an additional moved-layout example. Keep it separate from the original so each version can be tested using its own internal links.
Choose portable names
Lowercase, space-free names reduce initial surprises. HTML does not prohibit Turkish filenames, but URL encoding, manual typing and platform differences add unrelated complexity. Document text and filesystem naming are separate choices.
For a final check, open About directly rather than starting from the home page. Its return link should still work. Then identify every src reference that would need changing if you moved the image folder. A relative path belongs to a starting context, not permanently to its target file.
A local machine path is not a portable site path
A path such as C:\Users\Ali\Desktop\ilk-sitem\gorseller\notlar.svg describes one computer. Do not put it into the site as a shared image address. Use relative paths with forward slashes and consistent capitalization.
Open both HTML pages directly and test their titles, reciprocal links and image. We have a working little site without custom styling. The next HTML section will organize its content into meaningful page regions before we reach CSS.
References: Reference 1 · Reference 2