Sub topic 11
Map the structure to URLs
This chapter assumes you can read a sitemap and know the difference between global navigation and breadcrumbs. It also assumes you know what a URL (the address of a page) is. No programming is required, but the examples use a short Python script and a web server rule.
Why URLs belong to the IA
A URL is the only part of your structure that users see outside your own interface. It appears in the address bar, in search results, in chat messages, in bookmarks, and in printed material. A well-designed URL tells a person where they are before the page loads. A poor one, such as /page.php?id=48213, says nothing and breaks the sitemap you worked on.
URLs also last longer than almost any other design decision. Visual styles change every few years, but links shared today may still be clicked in ten years. Treat the URL scheme as part of the structure, and plan it from the sitemap instead of leaving it to whatever the content system generates.
Start from the sitemap
The simplest approach is to give each node in the sitemap one path segment, and build each page's URL by joining the segments from the root down. The sitemap from the earlier chapter produces this:
/ Home
/getting-started/ Getting started
/billing/ Billing
/billing/invoices/ Download invoices
/security/ Account security
/security/reset-password/ Reset your passwordThree things in this list are worth noting.
- The path depth matches the hierarchy.
/billing/invoices/is a child of/billing/, so a reader can remove the last segment and land on the parent. - Segments are short words, not copies of the full label. "Account security" became
security, and "Download invoices" becameinvoices. - Every URL ends with a slash and uses lowercase letters and hyphens. The same rule applies everywhere.
Generate paths from the sitemap
If the sitemap is data, you can turn it into URLs with a script and check it for mistakes before anything is built. This script gives each node an explicit slug, joins the slugs into paths, and stops if two pages end up with the same path.
sitemap = {
"name": "Home", "slug": "",
"children": [
{"name": "Getting started", "slug": "getting-started", "children": [
{"name": "Create an account", "slug": "create-account"},
{"name": "Set up your profile", "slug": "profile"},
]},
{"name": "Billing", "slug": "billing", "children": [
{"name": "Update payment method", "slug": "payment-method"},
{"name": "Download invoices", "slug": "invoices"},
]},
{"name": "Account security", "slug": "security", "children": [
{"name": "Reset your password", "slug": "reset-password"},
{"name": "Turn on two-step verification", "slug": "two-step"},
]},
],
}
def walk(node, parent_path="/"):
if node["slug"] == "":
path = parent_path
else:
path = f'{parent_path}{node["slug"]}/'
yield path, node["name"]
for child in node.get("children", []):
yield from walk(child, path)
seen = set()
for path, name in walk(sitemap):
if path in seen:
raise ValueError(f"Duplicate path: {path}")
seen.add(path)
print(f"{path:<40}{name}")Running it prints one line per page, with the path on the left and the sitemap label on the right. Storing the slug next to the label has a useful effect: you can rename a label without changing the URL, or the reverse, and the change is visible in review.
Rules for good paths
Apply these rules to every URL on the site. Consistency matters more than any single rule.
- Use words people can read.
/billing/invoices/is better than/b/inv/or/c/17/p/204. - Use lowercase and hyphens. Some servers treat
/Billing/and/billing/as different pages. Hyphens separate words clearly. Underscores can be hidden by link underlining. - Keep segments short. Drop filler words such as "the", "and", and "your". Keep the words that distinguish the page from its siblings.
- Pick one trailing-slash style.
/billingand/billing/are technically different addresses. Choose one, and redirect the other to it. - Leave out file extensions and technology names.
.phpand.aspxexpose your implementation and become wrong when you change it. - Do not put session data or tracking in the path. Those belong in cookies or, if unavoidable, in query parameters.
- Do not include dates unless date is the structure. News and blog archives can use
/2026/11/. A help article should not, because it will look stale when it is updated.
| Weak URL | Problem | Better URL |
|---|---|---|
| `/index.php?page=37` | Unreadable, tied to PHP | `/billing/` |
| `/Billing/Download_Invoices.html` | Mixed case, underscores, extension | `/billing/invoices/` |
| `/help/articles/how-to-reset-your-password-if-you-forgot-it` | Too long, repeats the question | `/security/reset-password/` |
| `/p/204/c/17` | Numbers carry no meaning | `/security/two-step/` |
Mirror the hierarchy, but not blindly
A URL that mirrors the sitemap helps users, but there are cases where you should deviate on purpose.
Do not mirror every level. If a sitemap has five levels, a five-segment URL gets long and fragile. Many sites cap paths at three or four segments. Where a page sits deeper than that, keep the nearest meaningful ancestor and drop the rest. A URL does not have to record the full route.
Do not let the URL encode a path that can change. Suppose "Download invoices" moves from Billing to Account. If the URL says /billing/invoices/, it is now wrong or must change. If a page could belong to several sections, give it one canonical home in the URL and let navigation link to it from the other places. A page that appears under two URLs splits its links, confuses analytics, and may be treated as duplicate content by search engines.
Do not put a person's data in the path unless needed. Pages such as /account/orders/48213/ are fine because the structure is orders plus an identifier. The identifier should be stable and should not reveal information. Access control still has to be enforced on the server.
Path or query string?
A URL has a path (/billing/invoices/) and an optional query string (?year=2026&sort=newest). Use the path for structure and the query string for views of the same page.
| Use the path when | Use the query string when |
|---|---|
| The page is a distinct destination in the sitemap | The page is the same content, filtered or sorted |
| People should be able to find it by browsing | The state is temporary, such as a page number or sort order |
| It deserves its own title and search result | The combinations are open-ended |
For example, /billing/invoices/?year=2026 is the invoices page showing one year. It is not a new place in the hierarchy. A filter that defines a real category, such as a product type with its own landing page, is a candidate to promote into the path.
Keep URLs stable and redirect when they change
The best URL is one you never change. Sometimes you must, because of a rename, a merge, or a restructure found during testing. When that happens, the old address must keep working. Send a permanent redirect (HTTP status 301) from the old URL to the new one. This preserves bookmarks and external links, and it tells search engines that the page moved.
This web server rule, in nginx syntax, redirects one old path to its new place:
server {
listen 80;
server_name example.com;
# Old help URL moved into the security section
location = /account/password {
return 301 /security/reset-password/;
}
# Enforce the trailing-slash style for known sections
location = /billing {
return 301 /billing/;
}
}Keep a redirect map as a living list: old path, new path, date, reason. Avoid chains in which A redirects to B and B redirects to C. Update the first entry so it points straight to the final address. Leave redirects in place for years, not weeks.
Common errors
- Letting the CMS decide. Default systems often produce IDs or auto-generated slugs from long titles. Set a slug rule and review slugs as you review labels.
- Changing the URL every time the label changes. Labels should follow user language, which shifts. URLs should stay put unless the page's meaning changes.
- Mixing styles. Having
/billing/,/Security, and/get_started.htmlon one site tells users that nothing is predictable. - Missing a 404 plan. People will mistype or follow old links. A helpful "not found" page with search and top-level navigation recovers some of them.
- Ignoring mobile apps. In an app there may be no address bar, but deep links and shared links still need stable paths. The same mapping applies.
Check your mapping
Before you build, review the mapping with a short checklist.
- Every sitemap page has exactly one canonical URL.
- Each URL has no more segments than the maximum you set.
- Slugs follow the same case, separator, and trailing-slash rules.
- Sibling slugs are different from one another.
- Query strings are used only for filters, sorting, and pagination.
- Every changed or removed URL has a recorded redirect.
Tree tests, covered in the next chapter, check labels and hierarchy, not URLs. Reviewing the URL list yourself is the check that catches duplicates and inconsistent style.
Exercise
A page titled "Download invoices" sits under Billing. The CMS generated the URL /Billing/Download_Invoices_2026.html. List three rules this URL breaks, and write a better URL.
Show answer
It breaks the lowercase rule (capital B, D, and I), the hyphen rule (underscores instead of hyphens), and the rules against file extensions and unnecessary dates (.html and 2026). A better URL is /billing/invoices/.
Exercise
The team renames the section "Account security" to "Sign-in and security" and wants to change the path from /security/ to /sign-in-and-security/. What do you recommend, and what must be done if the team goes ahead anyway?
Show answer
Keep /security/. The label can change with user language while the URL stays stable, and security still describes the section. If the team changes the path, every old URL under /security/ must get a 301 redirect to its new address, pointing straight to the final destination, and the redirects must stay in place for years. The old path must never be reused for different content.
Exercise
The invoices page can be filtered by year and sorted by date. Should ?year=2026&sort=newest be part of the path? Explain.
Show answer
No. Filtering and sorting give a different view of the same page, so they belong in the query string: /billing/invoices/?year=2026&sort=newest. Putting them in the path would create many near-duplicate pages that are not separate destinations in the sitemap.