All SEO Exercises
Write a title tag and meta description for a web page
Description: Your page is “Best running shoes for women”. Write a title tag and a meta description. The title should be 50 to 60 characters and the description 120 to 155 characters. Use the keyword “running shoes for women”.
Hint:
- Put the keyword near the start of the title.
- Say what the visitor gets in the description, and end with a small call to action.
Solution
<title>Best Running Shoes for Women: Top 10 Picks of 2026</title>
<meta name="description" content="Compare the best running shoes for women, with comfort, grip and price reviewed. See our top 10 picks and choose the right pair today.">
How it works
- The title is inside the recommended range, and the keyword is at the start.
- The description uses the keyword once, tells the benefit and has a call to action.
Read Title Tag and Meta Description.
Find the search intent of keywords
Description: Find the search intent of these keywords: “how to tie a tie”, “facebook login”, “best budget smartphones”, “buy iphone 15 case”.
Hint:
- Ask what the person wants to do: learn, go somewhere, compare or buy.
Solution
| Keyword | Intent | Best page type |
|---|---|---|
| how to tie a tie | Informational | Step by step guide or video |
| facebook login | Navigational | The login page of Facebook |
| best budget smartphones | Commercial investigation | Comparison or top list page |
| buy iphone 15 case | Transactional | Product or category page |
How it works
- “How to” is a sign of learning. A brand name with “login” shows that the person wants to go to one place.
- “Best” and “vs” show comparing. “Buy”, “price” and “order” show the wish to buy.
- The real check is to open the search results, and see what type of pages are ranking.
Read Search Intent.
Create SEO friendly URLs from page titles
Description: Convert these page titles into SEO friendly URL slugs: “10 Tips to Write Better Titles!”, “SEO & Content: A Beginner’s Guide”, “Best Running Shoes (2026 List)”.
Hint:
- Use lowercase, replace spaces with hyphens, and remove special characters. You can also remove small words like “to” and “a” to make it shorter.
Solution
10 Tips to Write Better Titles! => /10-tips-to-write-better-titles/
SEO & Content: A Beginner's Guide => /seo-and-content-a-beginners-guide/
Best Running Shoes (2026 List) => /best-running-shoes-2026-list/
We can make them even shorter by hand, for example /write-better-titles/, /seo-content-beginners-guide/ and /best-running-shoes/.
How it works
- The script changes everything to lowercase, makes
&into “and”, removes the special characters and joins the words with hyphens. - A shorter URL is easier to read, share and remember. Avoid the year in the URL if you plan to update the page later.
Read URLs and File Names.
Fix the heading structure of a page
Description: This page has a poor heading structure. Fix it.
<h1>Welcome to our shop</h1>
<h1>Running shoes</h1>
<h4>Men's shoes</h4>
<h4>Women's shoes</h4>
<h2>Shipping</h2>
<h5>Free delivery</h5>
Hint:
- Keep one H1, then H2 for main sections and H3 for parts of a section.
Solution
<h1>Running Shoes Shop</h1>
<h2>Running shoes</h2>
<h3>Men's shoes</h3>
<h3>Women's shoes</h3>
<h2>Shipping</h2>
<h3>Free delivery</h3>
How it works
- There is only one H1 which says the main topic of the page.
- No level is skipped (no jump from H2 to H5), so the page reads like an outline.
Read Headings.
Add alt text and size attributes to an image
Description: Improve this image tag. The picture shows a blue backpack on a table.
<img src="IMG_0023.JPG">
Hint:
- Rename the file, add alt, width and height. Add lazy loading if the image is not at the top of the page.
Solution
<img src="blue-backpack-on-table.webp" alt="Blue backpack on a wooden table" width="800" height="600" loading="lazy">
How it works
- The file name describes the picture, in lowercase with hyphens.
- The alt text describes it in a short natural sentence, without keyword stuffing.
- Width and height reserve the space, so the layout does not jump (CLS).
loading="lazy"delays the loading until the user scrolls near it. Do not use it for the main image at the top.
Read Images.
Rewrite weak anchor texts
Description: Rewrite these links to use better anchor texts.
<a href="/seo-title-tag/">Click here</a> to learn about titles.
For meta tags, <a href="/seo-meta-description/">read more</a>.
Hint:
- The anchor text should say what the next page is about, and still read naturally.
Solution
Learn <a href="/seo-title-tag/">how to write a good title tag</a>.
Also see our guide on the <a href="/seo-meta-description/">meta description</a>.
How it works
- Search engines and screen reader users get the meaning of the link from its text.
- Different pages get different anchor texts, which looks natural.
Read Anchor Tag and Links.
Write a robots.txt file to block folders
Description: Write a robots.txt for all bots which blocks the folders /admin/ and /tmp/, but allows the file /admin/help.html. Add the sitemap https://example.com/sitemap.xml.
Hint:
- Use
Disallowfor blocked folders,Allowfor the exception andSitemapwith the full address.
Solution
User-agent: *
Disallow: /admin/
Disallow: /tmp/
Allow: /admin/help.html
Sitemap: https://example.com/sitemap.xml
Googlebot /admin/users Blocked
Googlebot /admin/help.html Allowed
Googlebot /tmp/cache.txt Blocked
Googlebot /about/ Allowed
How it works
- The longer rule
Allow: /admin/help.htmlwins over the shorterDisallow: /admin/for that file. - The test shows that only the intended paths are blocked.
Read Robots.txt.
Block all PDF files and URLs with a parameter in robots.txt
Description: Write a robots.txt rule to block all PDF files, and all URLs which contain ?sessionid=.
Hint:
*matches any text, and$marks the end of the URL.
Solution
User-agent: *
Disallow: /*.pdf$
Disallow: /*?sessionid=
Googlebot /docs/manual.pdf Blocked
Googlebot /docs/manual.pdf?download=1 Allowed
Googlebot /shop/?sessionid=abc123 Blocked
Googlebot /shop/ Allowed
How it works
/*.pdf$matches any path that ends with.pdf. The URL with?download=1after it does not end with .pdf, so it is not matched by this rule./*?sessionid=matches any URL which has that parameter.
Read Robots.txt.
Add a canonical tag to a filtered page
Description: The page https://example.com/shoes/?sort=price&color=red shows the same shoes as https://example.com/shoes/ with a filter. Add a canonical tag so that search engines index the main page.
Hint:
- Put the tag in the head and use the full URL of the main page.
Solution
<!-- On https://example.com/shoes/?sort=price&color=red -->
<head>
<link rel="canonical" href="https://example.com/shoes/">
</head>
How it works
- The canonical tag tells Google that the clean URL is the preferred version.
- The main page itself should have a self referencing canonical with its own URL.
Read Canonical URLs.
Create an XML sitemap for three pages
Description: Create an XML sitemap for the pages https://example.com/, https://example.com/about/ and https://example.com/contact/.
Hint:
- Use the
urlsettag with the sitemap namespace, and oneurlwithlocfor each page.
Solution
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-09-01</lastmod>
</url>
<url>
<loc>https://example.com/about/</loc>
<lastmod>2026-08-12</lastmod>
</url>
<url>
<loc>https://example.com/contact/</loc>
<lastmod>2026-08-12</lastmod>
</url>
</urlset>
How it works
- The XML was checked and it is well formed (every tag is closed).
lastmodis optional, but add it only if it is the real date of the last change.- Save it as
sitemap.xmlin the root, add it to robots.txt and submit it in Search Console.
Read XML Sitemap.
Write Article structured data in JSON-LD
Description: Write JSON-LD for an article titled “How to Choose Running Shoes”, published on 2026-05-10, written by “Anita Rao”, on the site “Run Daily”.
Hint:
- Use
@type: Article, and a script tag of typeapplication/ld+json.
Solution
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Choose Running Shoes",
"datePublished": "2026-05-10",
"author": {
"@type": "Person",
"name": "Anita Rao"
},
"publisher": {
"@type": "Organization",
"name": "Run Daily"
}
}
</script>
How it works
- The JSON was parsed by a tool, so the commas and quotes are right.
- The markup must match the visible page: the same headline, the same author and the same date.
- Test it with the Rich Results Test or the Schema Markup Validator.
Read Structured Data.
Write BreadcrumbList structured data
Description: Write breadcrumb markup for the page https://example.com/shoes/running-shoes/ with the path Home > Shoes > Running Shoes.
Hint:
- Use
itemListElementwith aListItemfor each step and thepositionnumber.
Solution
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://example.com/" },
{ "@type": "ListItem", "position": 2, "name": "Shoes", "item": "https://example.com/shoes/" },
{ "@type": "ListItem", "position": 3, "name": "Running Shoes" }
]
}
</script>
How it works
- The positions start from 1. The last item is the current page, so the
itemURL is optional. - The markup should match the breadcrumb path which users see on the page.
Read Structured Data and Internal Linking.
Add hreflang tags for English and French pages
Description: The English page is https://example.com/guide/ and the French page is https://example.com/fr/guide/. Add the hreflang tags.
Hint:
- Every version must list both versions, including itself.
Solution
<!-- In the head of BOTH pages -->
<link rel="alternate" hreflang="en" href="https://example.com/guide/">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/guide/">
<link rel="alternate" hreflang="x-default" href="https://example.com/guide/">
How it works
- The links are reciprocal, so Google can trust them.
x-defaultis for users whose language is not in the list.
Redirect old URLs to new URLs with .htaccess
Description: Redirect /old-page/ to https://example.com/new-page/ with a 301, and redirect all http traffic to https.
Hint:
- Use
Redirect 301for one page, andRewriteRulewith a condition for https.
Solution
Redirect 301 /old-page/ https://example.com/new-page/
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
How it works
- The first line is a permanent redirect for one URL.
- The rewrite rule runs when the request is not https and sends the same path to https.
- After you save the file, check with
curl -Ithat the status is 301 and that the Location line is correct. This file needs the Apache server with mod_rewrite enabled.
Read Redirection.