2

(Pathauto: Leave case the same as source token values)

When I create a node with "Nullam vehicula pharetra" as title, the Pathauto module will create /content/Nullam-vehicula-pharetra as URL alias. But we can browse the same content with a different URL case, such as /content/NULLam-vehicula-pharetra.

How do I make Drupal strict on the URL alias case?

Wikipedia is good example about what I need. Two different case request return different contents:

1
  • As defined in all the relevant RFCs, the path portion of a URL is case sensitive. Drupal happens to ignore case in the path, but that's a feature of Drupal, not a characteristic of URLs. I don't know of an easy way to make Drupal 7 case-sensitive, and if you did this I suspect it would impact a lot of Drupal modules which might assume the path is always lower case.
    – anonymous
    Commented Jan 26, 2021 at 0:11

2 Answers 2

0

Even if you don't use pathauto, Drupal7 can not differentiate case sensitive urls. This 'issue' is not code related, but it has to be with the database collation. non-binary string comparison are case-insensitive by default.

A solution could be to set the 'alias' columns (menu_router.path, url_alias.alias) to binary (case-sensitive).

Be aware that changing the structure of those two columns in existing sites could result in broken links because paths/alias would have to match base on case.

0

I agree with Blanca.

Wikipedia, and wikis in general, use a completely different system of creating and linking pages.

The following doesn't answer your question but it might help with your approach.

To avoid search engine ranking issues I always select "Change to lower case" in /admin/config/search/path/settings, as well as use Global Redirect with "Case Sensitive URL Checking".

So if a you visited domain.com/Page you'd be redirected to domain.com/page.

This seems like a more logical approach to me. I don't think any user would expect to see different content according to case sensitivity. i.e. to take this a step further StackExchange.com is no different to stackexchange.com.

Of course, in your case, this might not make any sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.