pathauto

Greg's picture

Build Your Own TinyURL With Drupal AND Everything You Need to Know About Paths in Drupal

Drupal has some pretty amazing features to handle aliases and aliasing. They are also commonly misunderstood. This article is an attempt to shed some light on how URLs and aliases and redirects work in Drupal which, with the help of some contributed modules, automatically turn a Drupal site into a TinyURL-like service.

It All Starts With the Menu System

Most modules in Drupal have a hook into the menu system which allows them to declare paths to which they will respond. For example, the node module's hook to the menu system allows it to respond to requests for "/node/".

Clean URLs vs. ... Dirty? URLs

Drupal responds to the "q" parameter from the URL. http://growingventuresolutions.com/?q=node/1 tells Drupal to serve up the page for "node/1". Ever since about 2003 Drupal has used features of the web server so that http://growingventuresolutions.com/?q=node/1 can be "rewritten" to http://growingventuresolutions.com/node/1. This is the so-called "Clean URL" which removes the main query parameter from every Drupal page request. Sure, there are still some page requests like for the second page in a list of nodes but they are much less common.

Ever since Drupal 6.x, if your web server supports clean urls then they will be enabled during installation. This is great.

Internal Path vs. Path Alias


Greg's picture

Why You Should Use Pathauto (or at least Path Aliases for Many Pages)

I recently saw a comment about Pathauto and started writing a really long reply that seemed more valuable to share here.

Basically one of the questions people have is "Why should I use Pathauto? If I don't care about SEO is there any other reason?"

This is a valid question to me. There is some indication that users don't look at the URL bar. During the Usability testing at UMN we never noticed people looking at the URL bar in the eye-tracking data. But some people certainly do look at the URL bar - people who like "hackable urls" do

Hackable URLs

I use it extensively to create "hackable URLs" that are valuable to a user. A "hackable url" or "index alias" is the feature on a site where you have a post and then users can remove the title down to the previous URL element and get the other posts from that month, one more layer for the year, and one more for that user since forever. See - fun! I even made a movie about it:

Site Credibility Prior to the Click

I frequently get URLs sent to me via email and IM. Compare these two URLs:

http://drupalcampcolorado.org/node/38

vs.

http://drupalcampcolorado.org/content/our-sponsors

Which one are you more likely to click on? Which one helps you understand what content you are going to get before you even get there?

Easy to Remember URLs


Syndicate content

Featured Team Member

Ben enjoys working on cutting edge technologies and finding practical ways to use those tools to make better sites for clients, faster.

Drupalcamp Colorado

We had fun at Drupalcamp Colorado!

Drupalcamp Colorado

We Wrote the Book On Drupal Security:

Cracking Drupal Book Cover

We were at Drupalcon San Francisco

See the videos now: