A URL is built from five parts you control and arrange in a specific order

A URL (Uniform Resource Locator) is the address you type into a browser's address bar. When you create a URL, you are deciding how visitors will reach a specific page on your site. The structure is always the same: protocol, domain, path, file name, and optional parameters. You do not need special software to create one — you write it as plain text, and the browser reads it.

The five parts work together. The protocol tells the browser how to connect (almost always HTTPS). The domain is your site's main address (example.com). The path is the folder structure on your server (/blog/). The file name is the actual page (my-first-post.html). The parameters are optional additions that pass information to the page (?id=5&sort=date). A complete URL looks like this: https://example.com/blog/my-first-post.html?id=5

Key Takeaways

  • Every URL starts with a protocol (https://), followed by your domain name, then the path to the file on your server.
  • Use lowercase letters, hyphens instead of spaces, and descriptive words so visitors and search engines understand what the page contains.
  • Avoid special characters, question marks in the middle of the address, and overly long paths that confuse both people and browsers.
  • Parameters (the part after the ?) pass data to the page but should be used sparingly for filtering or sorting, not for core navigation.
  • Test your URL by typing it directly into the browser address bar to confirm the file exists and the path is correct.

The protocol: HTTPS is the only choice for live websites

The protocol is the first part of every URL. It tells the browser which language to use when talking to your server. For any website you publish to the internet, use HTTPS (the S stands for find). This encrypts the connection between the visitor's browser and your server, protecting passwords and personal information.

HTTP (without the S) is the older, unencrypted version. Most browsers now show a warning when you visit an HTTP site, and search engines rank HTTPS sites higher. Your web host or domain registrar can help you install an SSL certificate, which is what makes HTTPS work. Many hosts include it free with hosting plans. Once installed, every URL on your site automatically uses HTTPS.

The domain: Your site's main address

The domain is the part visitors recognize and remember: example.com, myblog.org, or yourcompany.net. You buy a domain from a registrar like GoDaddy, Namecheap, or Google Domains. Once you own it, every URL on your site begins with that domain.

The domain stays the same for every page on your site. If your domain is example.com, then all your URLs start with https://example.com/. You do not change the domain for different pages — you only change what comes after it. The domain is the foundation; everything else builds on top of it.

The path: Organize pages into folders

The path is the folder structure on your server. It comes after the domain and before the file name. Paths use forward slashes (/) to separate folders, and they help organize your content logically. A URL like https://example.com/blog/tutorials/css/ means there is a folder called blog, inside it a folder called tutorials, and inside that a folder called css.

You create paths by organizing files into folders on your server. If you use a content management system like WordPress, Squarespace, or Wix, the system creates paths automatically based on how you organize your content. If you code by hand and upload files via FTP, you create folders manually and place HTML files inside them. Keep paths short and descriptive — https://example.com/about/ is better than https://example.com/pages/company-info/about-us/company-background/.

The file name: Make it descriptive and lowercase

The file name is the actual page at the end of the path. It usually ends with .html (for a web page), .php (for a page that runs code), or no extension at all (if your server is configured to hide it). A complete path with file name looks like https://example.com/blog/my-first-post.html or https://example.com/products/blue-widget.

Write file names in lowercase with hyphens between words, never spaces or underscores. Use my-first-post.html, not My First Post.html or my_first_post.html. Lowercase matters because some servers treat uppercase and lowercase as different files, which can break links. Hyphens are easier for both people and search engines to read than underscores. Make the file name describe what the page contains — visitors and search engines both benefit from seeing the topic in the URL itself.

Parameters: Pass information without changing the file

Parameters are optional additions that come after a question mark (?). They pass information to the page without creating a new file. A URL like https://example.com/products?category=shoes&sort=price tells the page to show products in the shoes category, sorted by price. The page is still products, but the parameters change what it displays.

Parameters are useful for filters, search results, and sorting options. Do not use them for core navigation — do not create a URL like https://example.com?page=about when you could create https://example.com/about/. Parameters should be extra information, not the main way visitors navigate your site. Keep parameter names short and meaningful, and separate multiple parameters with ampersands (&).

Common mistakes that break URLs or confuse visitors

Spaces in URLs break the link. If you write "my first post.html", the browser converts the spaces to %20, creating a messy, hard-to-read address. Use hyphens instead: my-first-post.html. Special characters like &, %, #, and @ have special meanings in URLs and should be avoided in file names and paths. If you must use them, the browser will encode them, but it is cleaner to avoid them altogether.

Overly long paths confuse visitors and make URLs hard to share. If your path is https://example.com/blog/2024/january/week-1/monday/my-post.html, consider flattening it to https://example.com/blog/my-post.html. Changing a URL after people have linked to it breaks those links — if you rename a file or move it to a different folder, set up a redirect so old URLs still work. Most hosting control panels have a tool for this, or you can ask your web host for help.

Testing your URL in the browser

Once you create a URL, test it by typing it directly into the browser address bar. If the page loads, the URL is correct and the file exists. If you see a 404 error, the file does not exist at that location — check the spelling, capitalization, and path. If the page loads but looks wrong, the file exists but may be missing images or stylesheets, which means those files are in the wrong location or referenced with the wrong path.

Test every URL you create before sharing it with others. Click links on your site to make sure they point to the right pages. Use your browser's developer tools (right-click, then Inspect) to see exactly what URL the browser is trying to load when a link fails. This catches typos and path mistakes before visitors encounter them.

Frequently Asked Questions

Can I change a URL after I publish it?

You can change the file name or path, but old links will break. If people have bookmarked or linked to the old URL, they will see a 404 error. Set up a redirect (301 redirect) so the old URL automatically sends visitors to the new one. Most hosting control panels have a Redirects tool, or you can ask your web host to set it up for you.

Do I need to include .html at the end of my URLs?

You can configure your server to hide the .html extension, so https://example.com/about/ works the same as https://example.com/about.html. Most modern sites hide the extension because it looks cleaner. Your web host or CMS handles this automatically — you do not have to do anything. If you code by hand, ask your host whether they support extension-hiding.

What is the difference between a slug and a URL?

A slug is just the descriptive part of the URL — the file name and path without the protocol and domain. For https://example.com/blog/my-first-post, the slug is /blog/my-first-post. Content management systems use the term "slug" when you are editing a post, but it is the same thing as the path and file name combined.

Can I use uppercase letters in URLs?

Technically yes, but do not. Some servers treat uppercase and lowercase as different files, which can break links. Always use lowercase. If you type a URL with uppercase letters, the browser may convert it to lowercase automatically, but it is better to write it correctly from the start.

How long should a URL be?

Keep URLs under 75 characters if possible, though there is no hard limit. Shorter URLs are easier to read, share, and remember. They also look better when printed or displayed in an email. If your URL is longer than a few lines, simplify the path by removing unnecessary folders.