What Is a Clean URL?

Search engine-friendly URLs are also called clean URLs. These web addresses help bots and humans better understand your content’s purpose. A web address that’s short, easy to read, and keyword-rich is easier for search engine crawlers to find and index. Clean URLs get rid of confusion—like a random mix of symbols, numbers, and letters in the middle. As the name implies, search engine-friendly URLs improve site traffic and search engine site ranking.

How Do I Enable Clean URLs in Drupal 8 and 9?

One of the best features about Drupal 8 and 9 is that clean URLs are enabled from the start and can’t be deactivated. However, you may come across dirty URLs (URLs with the confusing symbols, numbers, and letters) if your web server wasn’t properly configured during installation. 

A dirty URL looks like this:

o8agency.com/?q=node/83 image of keyboard
 

A clean URL looks like this, although not as SEO-friendly as it could be: 

o8agency.com/node/83

In the dirty URL example, the “?q=” represents a URL parameter that’s being used to filter or sort content. In the clean URL example, the “?q=” disappears.

An SEO-friendly URL contains relevant categories and keywords that describe the page. The exact URL structure recommendation from Moz is as follows, where “primary-keyword” is likely the page title:

http://www.example.com/category-keyword/subcategory-keyword/primary-keyword

Continuing from our previous examples, the URL would look like this, where “social media” is a “service” we offer in the “digital marketing” space:

o8.agency/services/digital-marketing/social-media

Interested in our Drupal services?

How to Make Dirty URLs SEO-Friendly in Drupal 8 and 9

If you’re finding dirty URLs, follow these steps to enable clean URLs in Drupal 8 and 9 on a dedicated server:

  1. Enable mod_rewrite for Apache.

  2. In the output, verify the rewrite_module is in your module list. If not, it will need to be compiled in or made available as a loadable module. Don’t forget to restart Apache.

  3. Find the appropriate Apache configuration file for your site, which is usually located in /etc/httpd/conf, /etc/apache2, or a sub-directory.

  4. Copy the Drupal-specific settings into your configuration file. 
     

To get clean URLs to work in Drupal 8 and 9 on a shared server, you should only have to verify a sample .htaccess file exists in your Drupal installation. If you’ve done that, but you’re still having issues, here are some suggestions for troubleshooting problems with clean URLs:

  • Make sure the .htaccess file is being read.

  • Check to see if the RewriteBase setting needs to be changed.

  • Manually set the $base_url variable in the settings.php file. 

  • Create a special rule for each subdirectory if using multi-site.

  • Replace index.php with the URL path to your Drupal installation's index.php file.


You can find more detailed steps on how to fix clean URL issues in Drupal 8 or later by referring to this documentation on drupal.org.

What About Drupal 7 Clean URLs?

During the installation of Drupal 7, the installer tests for compatibility with clean URLs. If the environment is deemed suitable, clean URLs will be automatically enabled.

However, if clean URLs aren’t properly working in Drupal 7, you can still enable this feature post-installation:

  1. Go to Administer > Configuration > Search and metadata > Clean URLs.side profile of a laptop with hands typing on it

  2. Let the automated clean URLs test run.

  3. Check the “Enable clean URLs” checkbox.

  4. Click "Save Configuration."
     

To go more in-depth with information about enabling clean URLs in Drupal 7, take a look at this Drupal documentation.

Get Cleaner URLs With the Pathauto Module

That’s right. You can make clean URLS even more user-friendly with Drupal. Use the Pathauto module to enhance your site’s SEO-friendliness with URL aliases. 

For example, visitors looking for help with Drupal on our site will see o8.agency/services/drupal as a URL instead of o8agency.com/node/83. Pathauto makes the content of the web address much clearer for the web crawler and the human searcher. 

Why does Drupal remain a leading CMS?

Does Drupal Have Other SEO Modules?

Drupal offers many other search engine optimization modules to make sure your website is properly indexed.

Global Redirect (Redirect in Drupal 8 or later)

Drupal creates a path using the page identifier as well as a clean path alias for each web page on a site. The Global Redirect module ensures only the clean path’s enabled, preventing multiple path problems.

Path Redirect

If a path changes or disappears, this Drupal module wlil redirect the original path to another existing path or external URL prevents the user from receiving a 404 error.

Metatag

The Metatag module gives you the opportunity to provide structured metadata about your website such as meta description tag and meta keywords tag.Screen showing a Google Analytics dashboard

Site Verification

With Site Verification, Drupal confirms search engine site and domain ownership from websites such as Google, Yahoo!, and Bing. 

XML Sitemap

Drupal’s sitemap conforms to the sitemaps.org specification and helps search engines crawl the website and keep results updated. 

Page Title

Drupal lets you specify patterns for the page title structure and also distinguish the page title from the content title on content creation pages.

Menu Attributes

Drupal allows you to choose additional attributes for menu items such as id, rel, class, name, and style. 

Google Analytics

Drupal supports Google Analytics’ capabilities including in-page analytics, content analytics, site search reporting, event tracking, content experiments, site speed analysis, mobile analytics, and social analytics.

We can help you with SEO

What About the Drupal SEO Checklist?

Using the Drupal SEO Checklist is another way to make sure you’re fully optimizing your site. This list helps verify you’re using SEO best practices and identify ways you can improve. As Google makes algorithm changes, this checklist is updated so you get the latest information. When you complete items on the Drupal SEO Checklist, the date and time are marked next to each task. You’re able to keep track of what’s been completed and what still needs to be done.

Drupal Enables Search Engine-Friendly URLs…and Much More!

Whether you have the latest version of Drupal or an older edition, you can take advantage of search engine-friendly URLs and other SEO features that Drupal has to offer.

If you need help upgrading your Drupal site or boosting your search results—or both—the experts at O8 are ready to help.

Check out our Drupal and SEO services today!
 

Learn More About Drupal and SEO

Blog Categories

Comments

skyline


O8 is a web and digital marketing consultancy based in Minneapolis, MN offering expert-level UX Design, CRO, and strategic consulting, as well as highly-technical capabilities in Drupal, WordPress, and HubSpot

We work differently from traditional agencies in that we extend your team with ours.