Creating_Search_Engine_Optimized_Drupal_URLS

A big piece to search engine optimization is how your URLs are structured. A ways back, I was talking to a buddy of mine who does SEO for a living and he suggested that I use WordPress' URL rewrites to make my URLs friendlier. I went ahead and set my blog up for a yyyy/mm/dd/title format and it did wonders for my search rankings. Recently however, I moved to Drupal which sadly does not automagically create the friendly aliases to your posts. There is good news though. In typical Drupal fashion, there’s a module for that (kind of like "there’s an app for that") and it is very customizable.

To set yourself up with article urls (or blog urls) that autoalias with a format that you want, you need to grab two modules. First you need the Pathauto module, and that depends on the Token module. Before we continue, I’m writing this to fit a Drupal 7 scenario, so likely some of the stuff will be in a slightly different place if you’re running 6 or 5.

Now, once you have those enabled, head on over to the Configuration→URL aliases section of your Drupal site. Once there, select the pattern tab.

Where we put our aliasing string here depends on whether your writing your content as a blog or an article content type.

If you blog in article content types, put the following string in the Pattern for All Article Paths field:

[current-date:custom:Y]/[current-date:custom:m]/[current-date:custom:d]/[node:title]

If you blog in blog format, put the following string in the Pattern for all Blog entry paths field:

[current-date:custom:Y]/[current-date:custom:m]/[current-date:custom:d]/[node:title]

files/pathauto-alias-strings0.jpg

Keep in mind that I formatted those strings for blog entries. If you’re doing basic pages or something like those, you likely won’t want the format I used in this article. Just expand the Replacement Patterns section in your patterns tab to see what other options you have for formatting those URLs.

Category:Drupal