It is important that aliases on a site are unique. There are several ways to achieve this functionality. The rules for punctuation replacement can also have an impact on how these rules work. For this page the default punctuation rules are assumed.

Default Behavior

Pathauto itself will ensure that your aliases are unique by appending a hyphen and a number to the alias. So, if you use the pattern "users/[user-raw]" for User paths a user with the username "foo_-_bar" will get the alias of "users/foo-bar". If another user signs up with the name "foo-bar" then their alias will be "users/foo-bar-0" the -0 is incremented on each new alias that is the same until you get -1 -2 etc.

Since the -0 system of making an alias unique is not always desirable there are other solutions to keep the aliases unique.

Changing Pattern to include Unique Numbers

You can include the ID number of the object into the pattern like "users/[uid]-[user-raw]" which will insert the unique user id into the alias. This can be important for news sites to have a unique ID for each story using the [nid] pattern, for example. Some sites may prefer not to expose what is essentially a meaningless number in the alias.

Ensure the Values in the Pattern are Unique

You can also take steps to ensure that the items that will be placed into the alias are unique. For usernames one way to do that is to disallow the punctuation characters which will generally be replaced with the separator which will then be collapsed from multiple separators into one which can cause duplicates. For the usernames, you will need to create a module which allows usernames with A-Za-z0-9 and an underscore between the words (not at the beginning or end). You can add your validation function by hooking the registration screen and check for this regexp: ([A-Za-z0-0])+(_[A-Za-z0-9])*. This will force the user to either just use alphanumerical characters or just just one underscore between. A similar action can be taken in a small module for the node title or taxonomy name.

Use the -raw tokens

The raw tokens are necessary because the Path system in Drupal core will do it's own filtering on paths as they are used throughout Drupal. So, if you use the normal (not -raw) tokens then they may get double filtered which leads to odd behavior.