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%20url will be redirected to /some-url
  • /another url example will 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?

Installing this recipe on your website requires the following steps:

  1. click on "Install on my website"
  2. review the newly created rule and edit it to fit your needs
  3. publish the ruleset

Discover our recipes to improve your website's quality in one click

redirection.io's recipes are a powerful feature designed to simplify the implementation of front-end quality best practices for your websites. Think of them as a curated "app store" for your site, offering a variety of pre-configured solutions that can be installed with a single click.

Discover all redirection.io recipes