Posted to Ben Finklea's blog on August 27th, 2010

How to Clean and Optimize URLs in Drupal

Just like websites of yore, Drupal uses a query string to pull information from a database. Every single blog post, comment, content, user entry, and so on is stored in tables on the server so you need a query string to go find the data and bring it back to the browser window. This is a fancy way of saying “URL”.

The standard Drupal URL comes in “dynamic” form. This means that there are strange characters in the URL that aren’t exactly kosher for SEO. Now, I don't strange characters via Jar-Jar Binks, but strange written characters that usually require the shift key to type. Here are some examples of standard, dynamic Drupal URLs:

By no means have these URLs been “cleaned up” properly. Clean URLs are URLs that do not contain any strange characters like ?, =, &, (,), or $. In Drupal a clean URL look like this:

Clean vs. Optimized URLs

Don’t confuse clean URLs with properly optimized ones, though. While a clean URL can be easily read, it doesn’t necessarily tell the search engines what your web page or web site is all about. Search Engine Optimized URLs contain keywords that you are targeting for in search.

An example would be:

This URL indicates what content it is pointed at, and contains the keyword phrase: austin real estate. But before you can go optimizing the dickens out of your site, let’s turn on clean URLs in Drupal.

How to Turn on Clean URLs in Drupal

During installation, Drupal 6 will automatically run the clean URL test and will show you the results. If you weren’t the one to install Drupal or you don’t remember whether it worked or not, you should double-check to make sure that clean URLs are turned on.

1: Go to or visit your admin screen and click Clean URLs.

2: The Enabled radio button should be selected. If it is not, select it and click Save configuration.

If you cannot enable clean URLs

There is a remote possibility that your hosting company has some settings they need to adjust for you. Or you may need to edit your .htaccess file to make it work.

For common configuration issues, visit

How to Optimize URLs with the Path Module

Now that your site is pumping out clean URLs, you will need to start optimizing them. Clean URLs are not enough, no sir. Sure, search engines can read the URL much easier, but that is just the first step in making your website addresses work for better rankings.

Just like they look at Page Titles and body content, search engine spiders also comb through URLs for keywords. If you use keywords in your URL path, you will do much better than a site without them. Naturally, Drupal has a solution. The Path module allows you to write your own paths.

Drupal’s Path Module

A path is the part of the URL that comes after the top level domain – i.e. com, org, edu, biz, or info.

For example: in the URL: the path is /pez-dispensers/boba-fett.

The Path module allows you to manually create search engine friendly URLs based on your content. This allows you to get addresses that look like the following URLs:

instead of:

The Path module was originally written and maintained by the great Matt Westgate, who has contributed early and often to Drupal’s success. Since Drupal 4.3, the Path module has been included in the Drupal core.

How to turn on the Path Module

Although the Path module is part of the core of Drupal 4.3 and later, it is not turned on by default. You must do it yourself. Here is a step-by-step guide:

1. Visit the link, or go to the admin screen and click on Modules.

2. Find the Core - optional section and then find Path. Add a check in the box.

3. Click on Save Configuration.

4. Visit or go to Admin | User Management | Permissions and give permissions to users that need to create custom paths.

How to change a content path

Now you should be ready to change a content path on your Drupal site. Follow these easy directions and you are good to go:

1. Point your browser at the node for which you want to create a custom path.

• To create new content, visit

• To edit existing content, browse to the node and click on the Edit tab

2. In the URL path settings field, put the path that you wish to show in the URL. Only put the text that shows up after the / that comes after the base URL. If you want your alias to be then you would put about in the field.

3. Click on the Save button.

Writing Optimized URLs

To write your own optimized URLs, simply insert your keywords for the website into the path. For example, if your website targets gaming computers, put it in the path separated by dashes:

While at first it may seem intimidating, it is fairly simple once you get the hang of it. Once the search engine spiders have had a chance to reindex your website, you should start seeing some of your newly optimized URLs pop up a little higher in the search rankings.

Cleaning and optimizing your URLs is just one of many steps in the process of Drupal SEO. Please join me each Friday on our blog as I discuss Drupal SEO tips, news, and know-how for you and your Drupal website team.

Thank You For Reading!

No one likes people who don’t share, especially giant flying cats. So if you liked what you read, please share my post with any of our socially-labeled buttons, or we’ll sick Fluffy after you! Please subscribe to our RSS feed as well so you can receive daily fodder from our blog.