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.
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:
A clean URL looks like this, although not as SEO-friendly as it could be:
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:
Continuing from our previous examples, the URL would look like this, where “social media” is a “service” we offer in the “digital marketing” space:
Interested in our Drupal services?
If you’re finding dirty URLs, follow these steps to enable clean URLs in Drupal 8 and 9 on a dedicated server:
Enable mod_rewrite for Apache.
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.
Find the appropriate Apache configuration file for your site, which is usually located in /etc/httpd/conf, /etc/apache2, or a sub-directory.
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.
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:
Go to Administer > Configuration > Search and metadata > Clean URLs.
Let the automated clean URLs test run.
Check the “Enable clean URLs” checkbox.
Click "Save Configuration."
To go more in-depth with information about enabling clean URLs in Drupal 7, take a look at this Drupal documentation.
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?
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.
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.
The Metatag module gives you the opportunity to provide structured metadata about your website such as meta description tag and meta keywords tag.
With Site Verification, Drupal confirms search engine site and domain ownership from websites such as Google, Yahoo!, and Bing.
Drupal’s sitemap conforms to the sitemaps.org specification and helps search engines crawl the website and keep results updated.
Drupal lets you specify patterns for the page title structure and also distinguish the page title from the content title on content creation pages.
Drupal allows you to choose additional attributes for menu items such as id, rel, class, name, and style.
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
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.
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.