In the earlier hands-on section ("Hands-On: Content Management"), we created an "About Us" page and a "Home" page and added them to our site's menu. But if you return to those pages, you'll see that the URL is something like http://www.example .com/node/1. Wouldn't it be great if we could instead give these pages nice search engine-friendly URLs like http://www.example.com/about? We can, with Drupal core's Path module.
The Path module allows us to specify human-readable URLs, referred to as URL aliases, which mask Drupal's default way of naming paths:
1. Begin by navigating to the modules administration page at AdministersSite buildingsModules (admin/build/modules).
2. Under the Core - optional package, check the Enabled checkbox next to the Path module, as pictured in Figure 2-24, and click the "Save configuration" button at the bottom of the form.
[_j ujjciuu u.n - - i : > :i :> lu <jy 11 mJ yuur sue u^niy u pel 11 u.
li Path G 4 Allows users to rename URLs.
Required by; Pathadto (disabled), Catalog (disabled]
Figure 2-24. Enabling the Path module
3. Click on the About Us page in the menu, and click the Edit tab.
4. Toward the bottom of the form, you'll see a new fieldset called "URL path settings," as pictured in Figure 2-25. Enter about as the path, and click Save.
& Ce m ment settings URL pattl settings about
Optionally specify an alternative URL by which Ibis node cart he accessed. For example, type "about" when writing an about page. Use a relative path and don't adit a trailing slash or the URL alias won't work.
& Authoring information
Figure 2-25. Entering a path alias for a node
5. Now, if you click on the About link in the menu once more, you should see the URL change to http://www.example.com/about.
6. Repeat the previous steps to add a URL alias for the Home page as well, using home for the "URL path settings."
Setting URL aliases by hand can be tedious. The Pathauto module (go to http://drupal.org/project/pathauto), covered in Chapter 5, allows you to set up customized rules that automatically generate friendly URLs for all of your website content (http://example.com/content/about), users (http://example.com/user/admin), and more.
Was this article helpful?