Legacy Knowledge Base
Published Sep. 10, 2025

Getting same response from two URLs having space ( ) and hyphen (-)

Written By

Madhusudan Sharma

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When a friendly URL is created using hyphens (E.g. https://www.abc.in/test-my-friendly-url), then one more URL, same as the friendly URL, having space ( ) in place of the hyphen (-) (E.g. https://www.abc.in/test my friendly url) delivers the same response as the friendly URL when hit.

Environment

  • Liferay DXP 7.4

Resolution

  • This is the expected behavior of the product because while creating a URL, the '-' (hyphen) and the ' ' (space) are considered equivalent to each other.
  • Therefore, this is the reason, why both the URLs - https://www.abc.in/test-my-friendly-url and https://www.abc.in/test my friendly url delivers the same response.
  • Additionally, if we try to create a friendly URL without using '-' (hyphen) (E.g → https://www.abc.in/test.my.friendly.url or https://www.abc.in/test_my_friendly_url), and try to hit the same URL using space (E.g → https://www.abc.in/test my friendly url); the server will respond with a 404 error page.
  • Moreover, the URL that is stored is with '-' (hyphen) and the crawlers check for the stored URL (with the '-' hyphen) and not for that with the space. As a result, it will also not affect the SEO.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base