What are some best practices for structuring URLs in PHP applications to ensure they are semantically logical and unique?

When structuring URLs in PHP applications, it is important to ensure they are both semantically logical and unique. One best practice is to use a clear and descriptive URL structure that reflects the content and purpose of the page. Additionally, including relevant keywords in the URL can improve SEO and make the URL more user-friendly. Finally, using unique identifiers, such as IDs or slugs, can help differentiate similar URLs and prevent conflicts.

// Example of structuring a URL with a unique identifier (ID)
$id = 123;
$title = "example-page";
$url = "/pages/{$id}/{$title}";
echo $url;