Search engine friendly URLs are the addresses of your content that is easier for both bots and people to identify. It’s a way of cleaning up the links to optimize the site for search engines as well as improve visual recognition by visitors.
Keeping Drupal and clean URLs does more for your site than you might think. In fact, many experts attest to how “friendly” URLs improve site traffic as well as improve site ranking in engines like Google.
Today, I’m going to show you how to set up search friendly URLs in Drupal. It’s a quick and easy task that may improve how your site performs on the Internet in terms of gaining traffic.
Clean URLs and Drupal 8
By default, Drupal 8 uses clean URLs automatically when you build a new website. This option cannot be disabled directly from the admin panel.
As long as you use clean paths when creating articles and pages, the site will use those as well as any alias you use for the URLs themselves.
Clean URLs and Drupal 7
Drupal 7 and earlier versions will require a bit of finesse when setting up clean URLs. Normally I promote Drupal 8 in these tutorials, but I wanted to share how you can set cleaner links with the older versions of the content management system.
Editing the .htaccess File for Drupal 7
First, create a copy of your .htaccess file. If you already backup your Drupal website on a regular basis, you might not have to do this. The reason why you want to create a copy of this file is to make sure you have a working replacement should something go wrong.
The second step is to prepare the .htaccess file for clean URLs. This can be done by either using FTP programs like FileZilla or through cPanel’s File Manager. In this tutorial, I’m going to use the latter.
Access and edit the .htaccess file of your Drupal website.
If you’re using File Manager and you don’t see the .htaccess file, you will need to go to your settings in File Manager and enable hidden files.
Also, making changes like this to the .htaccess file means you’ll want to save a copy of it if and when you need to upgrade your version of Drupal.
Add the following code to your .htaccess file:
You can add the above coding and keep any of your current settings in .htaccess as long as they don’t conflict with one another. For instance, some of you may have rules for handling plugins, IP blacklisting and other functions. These can all remain intact while including the above commands.
When you’re done editing, save the file.
Setting Drupal 7 Clean URLs
By default, Drupal comes with the “Path” module already installed and activated. This add-on is what controls setting up search friendly URLs in Drupal. If you want to make sure this module is installed, click “Extend” in the top tool bar and scroll down to “Path.” Make sure it has a check mark next to its name.
If not, click the box and install it using the button on the bottom.
Click into the “Configuration” tool in the admin panel. Scroll down and click the link for “Clean URLs.” When you click this link, you’ll have a check box option to enable it. Click the box and save the configuration.
Now you’re website will deliver a cleaner URL when you develop articles and pages. This is just one of the many ways that Drupal web hosting can be customized to promote a website of any kind. Build something for yourself or the business and give visitors and search engines an easy link to follow.
Author: Josh Dargie
My name is Josh Dargie and I’m the Operations Manager at GreenGeeks. I’ve been with the company since 2009. I have over 16 years of experience working with and for various web hosting providers specifically in development, day-to-day operations and customer service.