Setting up search engine friendly URLs


  • We now go from one of the most basic tasks to one of the most important—setting up search engine friendly(SEF) URLs.
  • Sites created with content management systems such as Drupal, rely on interaction with the database for the display of content. Accordingly, the URLs often include query strings and other characters that are needed to extract that data from the database. (In contrast, a simple HTML site doesn't have this issue; as a result, its URLs are typically much simpler and lack the complexity seen in CMS-powered websites).
  • URLs containing query strings and other odd characters are hard for both humans and search engines to read. Ideal URLs are readable and tell us something about the content of the page. By default, the Drupal system produces complex URLs containing additional characters that serve no useful purpose for the site visitor.
  • Accordingly, your first step towards making Drupal more search engine friendly is to get rid of the messy URLs and replace them with SEF URLs. 
  • The Drupal system, with no additional configuration, produces a URL that looks something like http://www.yoursite.com/?q=node/2.
  • That is not search engine friendly. Not only is it hard to read, but also the odd characters and query strings will cause problems with some search engines.
  • Moreover, the URL is simply not human friendly; it is hard to remember and even harder to type accurately.
  • However, with a bit of configuration, you can get Drupal to produce a URL that looks something like http://www.yoursite.com/how-search-engines-work.The previous URL is both search engine friendly and human friendly and is superior for both reasons.
  • Everything you need to create optimal SEF URLs is included in your default Drupal installation. Two different Drupal features combine to produce the result we saw in the previous example—Clean URLs and the Path module. In Drupal 7, the automatic installer will try to enable both of these features for you at the time the site is installed. In most cases, you should not need to do anything else (except of course write any
  • custom URL aliases you want).