Lesson 3 / الدرس 3
The URL and its parts / العنوان وأجزاؤه
An address is not one thing. It is six, and each is read by a different part of the journey — one by the browser, one by DNS, one by the server, and one that never leaves your machine at all.
العنوان ليس شيئًا واحدًا. بل ستة، ويقرأ كل واحدًا منها جزء مختلف من الرحلة — واحد للمتصفح، وواحد لـ DNS، وواحد للخادم، وواحد لا يغادر جهازك إطلاقًا.
The first step of the journey is the browser reading what you typed. A full address — a URL — is a small structured sentence, and each part is an instruction to a different participant. Learning the parts is what lets you read an address and predict what will happen.
The six parts
https://training.gt4it.com:443/lesson/web/the-url?page=2#parts
└─┬─┘ └───────┬────────┘ └┬┘└────────┬───────┘└──┬──┘└─┬─┘
│ │ │ │ │ └ fragment
│ │ │ │ └────── query
│ │ │ └────────────────── path
│ │ └───────────────────────────── port
│ └───────────────────────────────────────── host
└─────────────────────────────────────────────────────── scheme
https, 80 for http), and the fragment is optional. https و80 لـ http)، والجزء الأخير اختياري.-
Scheme — which protocol to speak.
httpsmeans "HTTP, encrypted". Read by the browser.البروتوكول (scheme) — أي بروتوكول نتحدث. فـhttpsتعني "HTTP مشفّرة". يقرؤه المتصفح. -
Host — which machine. This is the only part DNS ever sees. المضيف (host) — أي جهاز. وهذا هو الجزء الوحيد الذي يراه DNS.
-
Port — which door on that machine. Defaulted, so rarely typed. المنفذ (port) — أي باب على ذلك الجهاز. له قيمة افتراضية، فنادرًا ما يُكتب.
-
Path — what you want from that machine. Sent to the server. المسار (path) — ما تريده من ذلك الجهاز. يُرسل إلى الخادم.
-
Query — extra named values after a
?, joined by&. Also sent to the server.الاستعلام (query) — قيم إضافية مسمّاة بعد?، تُوصل بـ&. ويُرسل هو أيضًا إلى الخادم. -
Fragment — everything after
#. Handled entirely by the browser and never sent anywhere.الجزء (fragment) — كل ما بعد#. يعالجه المتصفح وحده ولا يُرسل إلى أي مكان.
What is sent, and what is not
<a href="/lesson/web/dns">a path on this host</a>
<a href="?page=2">the same page, a different query</a>
<a href="#bottom">a fragment — no request at all</a>
Referer المرسلة إلى الموقع التالي الذي تزوره. فلا تضع فيه أبدًا كلمة مرور أو رمزًا أو أي شيء خاص. وهذا أحد أسباب استخدام نموذج الدخول لـ POST، وهو ما يعود إليه الدرس 10.& داخل قيمة، أو أي حرف عربي. فتُرمَّز بالنسبة المئوية: تصبح المسافة %20، وتصبح عربي سلسلة من %D8…. والمتصفح يفعل ذلك عنك؛ ولا تستحق معرفته إلا ليكفّ شريط العنوان عن أن يبدو معطوبًا.| Part | Read by | Sent to the server? |
|---|---|---|
| scheme | The browser | No — it decides how to connect |
| host | DNS, then the connection | Yes, as the Host header |
| port | The connection | No |
| path | The server | Yes |
| query | The server | Yes — and it is logged |
| fragment | The browser only | Never |
Who reads what. The last row is the one people get wrong.
Try it live / جرّب بنفسك
Check yourself / اختبر نفسك
1. Which part of a URL is never sent to the server?
The fragment is handled entirely by the browser. It is why an in-page link scrolls without a request, and why a site cannot read what comes after the #.
#.2. Why should a password never go in the query string?
HTTPS protects it in transit, but it is still written down in several places at both ends. Encryption of the connection is not the same as the value being private.
3.
In https://example.com/shop?id=7, which part does DNS look up?
https://example.com/shop?id=7، أي جزء يبحث عنه DNS؟DNS only ever resolves the host. The path and query mean nothing until a connection exists and a request is sent.
Score / النتيجة: 0 / 3
Your task / مهمتك
Take a long URL from a site you use — a search result or a product page — and break it into its parts on a page, labelling each one and saying who reads it. Then write one sentence on what the query values appear to mean.
خذ عنوانًا طويلًا من موقع تستخدمه — نتيجة بحث أو صفحة منتج — وقسّمه إلى أجزائه في صفحة، وسمِّ كل جزء وقل من يقرؤه. ثم اكتب جملة واحدة عمّا يبدو أن قيم الاستعلام تعنيه.
- Every part present in the URL is labelled كل جزء موجود في العنوان مسمّى
- Each label says who reads that part كل تسمية تقول من يقرأ ذلك الجزء
- A sentence explains what the query values seem to do جملة تشرح ما يبدو أن قيم الاستعلام تفعله