Space in the URL
What it is
The page’s URL contains a space, either typed as a literal space or already encoded as %20, as in /pricing guide or /pricing%20guide. A space is not a legal character in a URL: RFC 3986 only allows it percent-encoded, so browsers request it as %20.
Why it matters
The encoded space makes the address ugly wherever it is shown or pasted: in search results, emails and documents. Where the address is written with a literal space, email and chat apps often end the link at the space, so it points to an address that does not exist. Tools that encode the space differently can also leave you with two addresses for one page.
How Asky checks it
Asky checks the page’s full URL as your sitemap lists it, path and query string together. The page is reported when the URL contains a literal space or the sequence %20. A + that stands for a space in a query string is not detected. The check runs in every audit, including audits of selected pages, on every page whose HTML Asky fetched; a page answering 4xx or 5xx is reported for its status alone. A URL that redirects to another audited page reports only the redirect.
Reported as an error with medium severity.
How to fix it
- Replace each space in the page’s slug with a hyphen, for example
/pricing-guide. Most CMSs build slugs with hyphens, so a space usually comes from a hand-typed slug, a file name or an imported page. - Add a 301 redirect from the old address, as browsers request it with
%20, to the new one. - List the new URL in your sitemap and in the page’s canonical tag. An old URL left in the sitemap is reported as a redirect.
- Update your internal links to the new URL. Links left on the old address are reported as links to internal redirects.
- If the space sits in a query value, such as a search term, change whatever builds that URL to use hyphens, or keep the URL out of the sitemap if it is not meant to be indexed.
Example
https://example.com/pricing%20guide is listed in the sitemap. After the fix, the sitemap and internal links name https://example.com/pricing-guide, and the old address answers with a 301 to it.