This recipe automatically redirects URLs containing spaces (represented as %20 or actual spaces in the URL) to their equivalent version where spaces are replaced with hyphens.
For example:
/some%20urlwill be redirected to/some-url/another url examplewill be redirected to/another-url-example
This recipe is highly useful for maintaining clean, SEO-friendly, and user-friendly URLs. URLs with spaces are often problematic: they can break links, be harder to share, and are generally less preferred by search engines.
By automatically converting them to their hyphenated equivalents, you ensure a consistent URL structure, improve user experience, and prevent potential SEO issues related to duplicate content or broken links. It's a proactive solution to handle legacy links or external links that might incorrectly include spaces.
This recipe not only handles single spaces (e.g., /some%20url to /some-url) but also intelligently processes consecutive spaces, replacing any sequence of multiple spaces (e.g., /another%20%20url or /multiple spaces) with a single hyphen, resulting in clean URLs like /another-url or /multiple-spaces. This ensures that even poorly formed URLs with multiple spaces are normalized to a concise and consistent format, preventing issues with excessive hyphens and maintaining optimal readability and SEO.
How to install this recipe on my website with redirection.io?
-
1. Configuration -
2. Installation -
3. Validation
Installing this recipe on your website requires the following steps:
- click on "Install on my website"
- review the newly created rule and edit it to fit your needs
- publish the ruleset