Drupal Tip #11: Friendly URLs in your forum with Pathauto

Friendly URLs are mandatory if you want to improve the Search Engine Optimization (SEO) of your forum. It is indeed really useful because, instead of having URLs that look like forum/tid/405 or node/1234, you will have textual URLs that have a link with the topic of the page, like /discussion/increase-the-traffic-your-online-community/possible-way-increase-traffic.

It is therefore better for users browsing your website, and as well when users look for an answer to their questions into Google, Bing and so on.

Friendly URLs using Pathauto

The perfect Drupal module that supports this feature is called Pathauto, and it has to be enabled with Path alias (Drupal core module).

  1. First download the Pathauto module, and unzip it in your modules folder.
  2. Then, go to your Site Building, Modules menu and enable the Path (if it is not already done) and Pathauto modules, if it is not already done.

    Enable Path Module
    Enable Pathauto Module
  3. In order to have comprehensive URLs, you need to be sure that you are using the Clean URLs setting. If it is enabled, then you should not see URL like this one: www.example.org?q=node/121, but www.example.org/node/121. The main difference is that the first request is considered as the same page with a specific parameter while the second looks like a dedicated page. It is more clear for your users, and for search engines (and SEO, obviously).

    Go to Site Configuration, Clean URLs menu and enable this option.

    Enable Clean URLs

    Note: This will work only is a rewriting module is in place, i.e. mod_rewrite for Apache. The .htaccess file bundled with your Drupal installation is intended for this:

    # Various rewrite rules.
    <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
      RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
      # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    Be sure this section is taken into account (it could require the Apache directive AllowOverride All in the configuration of your virtual hosts (httpd.conf / apache.conf configuration files)

  4. Now, you need to configure properly the General Settings of the Pathauto module. Go to Site Building, URL aliases, and click on the Automated alias settings tab.

    Here is a screenshot of our configuration.

    Pathauto General Settings

    Here is the settings to not forget

    • Use a dash - as a separator. It is indeed considered by Google as a word separator. Underscore should be valid as well, but Google explanations are a bit fuzzy on this topic.
    • Use the Create a new alias. Delete the old alias. Update Action if you do not care about history, and if your users are not supposed to change the title of their topic often. The Create a new alias. Redirect from old alias. is the perfect option for creating what we call here Shadow Topics. Old URL will be kept and will redirect to the new one. When you are using some forum rules like put a [Resolved] prefix on topics with a valid answer, this option should be ticked.
    • Last but not least, here is the list of words we are ignoring when creating a URL. These words won't give any useful clues about the meaning of topic, so why using them? Moreover when the URL length is limited to 100 characters.


  5. Last step consists of choosing the way your URL will be defined. This is the last section, called Forum paths of the settings page, available at Site Building, URL aliases, Automated alias settings tab.

    Configure Pathauto Forum Paths settings

    Your choice will depend on how you plan to manage your forum URL. We personally choose the following mapping discussion/[cat-raw], where discussion put everything below the forum root path, and where [cat-raw] will be replaced by the list of categories of the current topic.

    In this case, the following URL could be splitted in three parts:

    • discussion: the root page of the forum.
    • general-discussions-about-forum-softwares: the section in which this topic is located, i.e. General Discussions about Forum Softwares
    • how-deal-spammers: title of the topic

    Note that we haven't used the [catpath-raw], which would generate in the previous case an additional subcategory: /general-questions between /discussion and /general-discussions-about-forum-softwares. This is made on purpose, because we have to be careful with the URL length limit (the URL would be discussion/general-questions/general-discussions-about-forum-softwares/how-deal-spammers!)

You can now test your settings by creating new topics in different sections and see if everything goes well. Your forum should be now ready for being crawled by world search engines, congratulations!

Comments are closed.

Comments (7)

Great information, thank you.

Great information, thank you.


Drupal in my opinion is the

Drupal in my opinion is the most search engine friendly, out of the box, solution in existence today. However, with that said, there are still some things that need to be done to any installation to ensure search engine success.


what are you doing Gemsberm?

what are you doing Gemsberm? this is a very good blog.... Why?

lastnico's picture

Hi, I did the cleanup, thank


I did the cleanup, thank you for noticing it.

FSR Admin - Vote for 2012.


can you plz tell me how to

can you plz tell me how to increase the width of the region inside the panel
i want to show the region on full page but it shown only in the middle region of the page in the drupal
plz tell me the way so that i can increase the width of the region inside the panel.

thanx & BestRegards
siddhartha saini


Its the great way to explain

Its the great way to explain the thing. I read and done and its working for forum container and forum terms but its not working for all forum topics. Can you tell me little about that too.
BTW thanks for the tutorial


This forum is excellent! I

This forum is excellent! I love what you do, thank you very much to you and the members of this forum.

  Top Top