Download & Extend

Using URL aliases makes URLs case insensitive

Project:Path
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

If you use the path module for URL aliases, the aliases are case insensitive. This is bad for SEO because search engines see two different URLs as being different pages of duplicate content.

Example:
http://www.google.com/index.html
http://www.google.com/index.HTML

Example:
drupal.org/handbook
drupal.org/handBOOK

[copy and paste the above URLs; I don't want to create links]

URLs should be case sensitive.

Comments

#1

Lines 223 - 231 in Drupal 5.7 Path module:

      case 'load':
        $path = "node/$node->nid";
        // We don't use drupal_get_path_alias() to avoid custom rewrite functions.
        // We only care about exact aliases.
        $result = db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path);
        if (db_num_rows($result)) {
          $node->path = db_result($result);
        }
        break;

Is it a MySQL problem?
http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html
http://www.delphifaq.com/faq/databases/mysql/f801.shtml
http://mysqldatabaseadministration.blogspot.com/2006/09/case-sensitive-m...

#2

I've written a longer article about this problem here with some images.

#3

subscription

#4

This could be solved if url_alias declared src and dst fields as binchar, instead of varchar. I don't think it's necessarily directly possible with current DB abstraction layer in Drupal. However an update hook in .install could update the table and change column type if the db_type=mysql?

Just athought.

#5

BTW the path module is not necessary for this problem to manifest itself. Disabling said module, we have:

/user == /USER

Disabling, friendly URLs we have

?q=user == ?q=USER

As discussed above the root cause of problem is collation. In addition to {url_alias}, the {menu_router} table and associated queries need consideration.

nobody click here