Enable Clean URLs

easy enable clean URLs for seo

A query string is text in a URL preceded with a “?”. Query strings get in the way of search engines.

Drupal’s “clean URLs” rewrite query strings into human-readable text. While Google isn't bad at understanding URLs with query strings, it doesn’t always get it right. The best practice is to make sure your URLs don’t contain query strings.

Clean URLs are installed on your Drupal 8 site by default and cannot be turned off. But, it is possible that the server your site is on hasn't been properly configured, so it’s worth checking to be sure.

Complete Drupal.org documentation on Clean URLs can be found here.

How to tell if clean URLs are enabled

  1. Open an Incognito window and go to the homepage of your website.
  2. Click on a piece of content on your site. You need to navigate to an actual blog post or node, not the home page.
  3. Look for "?q=" in the URL.clean urls vs unclean urls
    1. If the URL looks like this: https://drupal8.dev/my-blog-post-title then clean URLs are enabled and you can skip to the next section of this guide.
    2. If the URL looks something like this: https://drupal8.dev/?q=node/4 then clean URLs are not enabled. Continue in this section.

How to fix your URLs if they are dirty

Here’s the good news: there’s nothing you can do yourself to fix your dirty URLs. You need to get in touch with your developer or hosting company and say this magic sentence:

“It looks like my URLs are dirty because I’m seeing “?q=” in the paths. Would you please enable mod_rewrite for Apache on my server?”

You can point them to this URL: https://www.drupal.org/getting-started/clean-urls#dedicated which explains things in more detail, but the magic sentence above will normally get the job done.

Once mod_rewrite is turned on, you should use an incognito window to test the URLs again.


Did you like this walk-through? Please tell your friends about it!

facebook icon twitter social icon linkedin social icon