In the previous section we enabled Clean URLs to make the site URLs look like normal URLs. However they are still not very descriptive.

For example, our website “About” page will now have a path like:

node/8

We would prefer it to have a path of about-cookiewiki or something similar. Does it matter? The site will work perfectly well if our about page path is node/8, provided everything which needs to link to it uses the correct URL. But a descriptive path is more intuitive for users, and might help push your site up the search engine rankings.

The Path module allows us to set an alternative path for specific pages on your site. It is a manual process (you must choose a the path for each page) so you would normally only do this for the main pages on your site. For “bulk” content (such as the recipes on cookiewiki.com, news articles on a news site, etc), you might find it easier to use the Pathauto module (described later) to create descriptive path names automatically.

Using Path

Path is a core Drupal module, but it is not enabled by default. You need to enable it first, locating the Path module in the Modules page.

Once Path is enabled, every time you create or edit content, you will see an extra group in the content edit page, called URL path settings. This has a single field where you can enter an alternative URL for the page content.

There are some guidelines for strings to use for paths:

  • Generally it is best to stick to lower case letters, numbers, hyphen, underscore, dot and forward slash.
  • Avoid spaces and special characters, because they are often converted to %XX, which is ugly. For example, a space is converted to %20.
  • Don't put a forward slash at the start or end of the path. Use about not /about or about/. You can use forward slash to separate path components, eg usa/prices.
  • Don't use an absolute URL (eg *http://ww.cookiewiki.com/about").
  • You can't use the same path for two pages, Drupal won't let you.

Porting an existing site

Another use of the Path module is to retain existing links when porting an existing site to Drupal.

If your website has been online for a while, you might have a lot of external sites which link to your key pages, which might bring in a lot of traffic. If you port to Drupal and the URLs of these pages change, it can be difficult or impossible to get the links updated.

With Path you can keep the URLs of your key pages unchanged.

Managing Paths

If you need to change or remove Path aliases after creating a node, you can always navigate to the node and edit it, then use the URL path settings group to update it.

However, there is also a URL aliases page where you can see and manage all your paths. Go to Navigation | Administer | Site building | URL aliases. This is only present if you have Paths enabled. This page displays all your paths and lets you edit or delete any of them.

Filtering for easier searching

The page also has a simple Filter aliases function. Simply enter some text, push the Filter button, and you will see only the matching aliases. This is useful if you have lots of aliases. Any aliases which don't match the filter aren't displayed.

The filter will match any alias which contains the string you enter. "ice" would match "ice-cream", "nice-cakes" or "egg-fried-rice" (or just "ice"). You can also use an asterisk to match anything, "c*m" would match "ice-cream" (cream matches c*m) or "clam-chowder" (clam matches c*m).

It is usualy best to use a simple alias. If you find there are too many false matches, by all means refine it.

Multiple aliases

The URL aliases page (at Navigation | Administer | Site building | URL aliases) has an Add tab. You can use this to add new aliases, in much the same way as you would use the URL path settings group when editing an individual page.

The Add tab gives you an extra capability. You can add new aliases to nodes which already have an alias applied. That is to say, you could have two or more different URL paths which both point to the same content.

This can be useful, especially when porting an existing site. Suppose you want to restructure your website, using Path to arrange your paths in a logical structure. But you also want to use Path to simulate