ENABLE CLEAN URLS IN DRUPAL

Drupal's "clean URLs" rewrite query strings into human-readable text.

A query string is a text in a URL preceded by a "?". For example https://example.com/?q=node/44

Query strings get in the way of search engines and are bad SEO practices. Google is not bad at understanding URLs with query strings, but it doesn't always get it right. The best practice is to make sure your URLs do not contain query strings.

Or put another way, if you care about SEO, you should be using "clean URLs."

Clean URLs are enabled in Drupal 8 by default and cannot be disabled. But it is possible that the server your site is on has not been configured correctly and therefore they could not be turned on by default, so it is worth checking to be sure.

The full Drupal.org documentation on clean URLs can be found here.

How to find out if clean Urls are enabled

  1. Open an incognito window and go to the home page of your website.
  2. Click on a piece of content on your site. You should navigate to an actual blog post or node, not the home page.
  3. Look for "?q=" in the URL.
  • If the URL looks like this: https://example.com/my-page-title, clean URLs are enabled and you do not need to do anything else.
  • If the URL does not have a "readable text" but uses machine names like "node" or "taxonomy" (Example: https://example.com/node/23). Then the clean URLs are enabled, but they are not configured to have the best SEO. I highly recommend using the Pathauto module to be able to automate the creation of clean, beautiful and SEO friendly URLs.
  • If the URL looks like this: https://example.com/?q=node/23 , clean URLs are not enabled. You have a problem with your server.

How to fix dirty URLs

Here's the good news: there is nothing you can do yourself to fix your dirty URLs. You must contact your developer or hosting company and say this magic sentence:

"It looks like the URLs are dirty because I see"?q="in the paths. Could you enable mod_rewrite for Apache on my server? "

You can direct 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 usually do the job.

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

Have Any Project in Mind?

If you want to do something in Drupal maybe you can hire me.

Either for consulting, development or maintenance of Drupal websites.