Using URL aliases makes URLs case insensitive

J. Cohen - June 28, 2008 - 22:03
Project:Path
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

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.

#1

J. Cohen - June 29, 2008 - 00:27

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

J. Cohen - October 12, 2008 - 00:33

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

#3

jpfle - December 19, 2008 - 22:22

subscription

#4

irakli - August 8, 2009 - 05:27

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.

 
 

Drupal is a registered trademark of Dries Buytaert.