In this video, we'll take a look at the core Path module. We'll see how it works, and why it's not an ideal solution by itself.

Why use Path and Pathauto?

Before we install and enable the Pathauto module, lets take a look at why we should use it.

Out of the box, Drupal uses a "node/nid" URL path system. So, if we create an article, it will be at example.com/node/1, and the next will be at example.com/node/2 and so on. Then, if we create a Basic Page, it will be at example.com/node/3. So because articles and pages are both nodes, the numbering system continues. Our next article would be example.com/node/4 because the basic page took the /node/3 URL.

What they do

The Path and Pathauto modules allow you to create custom URLs for your content.

The default numbering system is very flexible in that there will always be an automatic, unique URL for each piece of content on the site.

  1. However, It's not good for SEO (How is Google, or someone searching on Google supposed to know what example.com/node/235 is?).
  2. If someone sends a link to your site in an email, they'll have a much better idea about what to expect if the link is example.com/about rather than example.com/node/7.
  3. example.com/about is also significantly easier to remember than example.com/node/7.
  4. And it will also make it possible for "URL Hackers" to find content they want. For example if you have a blog, and the URL includes the year and month of the post (ie: example.com/blog/2012/11/awesome-blog-title), some users will delete the title to see what else you posted in november of 2012. They may even try to checkout what you posted in October by replacing the 11 with 10. Without Pathauto creating a URL structure like that is time-consuming and error-prone.

Using the Path Module

The core "Path" module allows users with permission to assign custom URLs to content. So when you create content, at the bottom of the page in the "URL path settings" tab, you can enter a custom URL alias. I'll create an "About" page, and set the URL alias to "about". After the page is saved you'll find it at example.com/about.

Now, this is great, but like I said, it's time-consuming and error prone to have to set each alias by hand. This is where Pathauto becomes invaluable!