Search engine optimization (SEO) is an important part of managing a website. Search engine traffic will help your website grow in popularity and reach its intended potential. A way to help give your site some SEO juice is by making the URLs to your web pages SEO friendly.

In this tutorial, we will cover how to make the URLs for your Drupal website search engine friendly.

Note: If your version of Drupal is 7 or above, then you do not need to perform any modification as all the necessary code is set by default.

For those who have an instance of Drupal prior to Drupal 7, there are 3 steps involved in ensuring your URLs are search engine friendly.

Step 1: Modifying the .htaccess file
Step 2: Enabling the Path Module
Step 3: Confirmation

Let’s get started.

Step 1

The first step in the process consists of modifying the default .htaccess file. The file is located in the directory where your Drupal website resides.

Download and open the .htaccess file, delete all content within and paste the code below:

RewriteEngine on
RewriteBase /drupal
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

The second line of code, “RewriteBase /drupal”, needs to be replaced with the relative path to your website. For example:

If you installed Drupal in the root directory of your domain, then the line of code will read:

RewriteBase /

If you installed Drupal in a sub-directory, then the line of code will be:

RewriteBase /sub-directory

Save the .htaccess file and upload it back to your website folder.

Step 2

In this step, we will enable the Path Module in your instance of Drupal.

Log in to the administrative area of your Drupal website and click Modules.

Locate the Path Module in the list of available modules. Click the check box next to Path.

Note: This box may already be checked by default. If this is the case, do not uncheck it.

Then hit “Save configuration” at the bottom of the page.

Step 3

Lastly, we need to ensure that our settings have taken effect. To do this, click Configuration from your dashboard.

Then hit Clean URLs.

In the following screen, ensure there’s a check mark next to “Enable clean URLs” and hit “Save configuration”.

And that’s it! Your URLs are now search engine friendly. If you click any link on your Drupal website, you will see that the links are comprised of legible text with no code terms or symbols such as “?”,”=” and so on.

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *