URL Structure
A URL (Uniform Resource Locator) consists of several components:
- Protocol: https:// or http://
- Domain: example.com
- Port: :8080 (optional, defaults to 80 for HTTP, 443 for HTTPS)
- Path: /path/to/page
- Query String: ?key=value&foo=bar
- Fragment/Hash: #section
URL Encoding
URL encoding converts special characters into percent-encoded format (%XX) so they can be safely transmitted in URLs. Spaces become %20, & becomes %26, etc. This prevents conflicts with reserved URL characters and ensures proper data transmission.
Query Parameters
Query parameters pass data to web servers via URLs. They start with ? and use key=value pairs separated by &. Understanding query parameters is essential for API development, analytics tracking, and dynamic web applications.