How to Enable Clean URLs in Drupal 7 on a Shared Server

By default, Drupal uses dynamically generated URLs which are less search engine friendly as they may prevent search engines from indexing pages. The URLs are in this format: If you want your pages to be better indexed and the addresses more readable to the human being, you can enable clean URLs which remove the special characters “?q=”.

For Drupal 7, clean URLs are enabled automatically in the installation if there is no compatibility issue, but the activation may fail due to some reasons like the disallowance of URL rewrite. At this time, you will need to enable the feature manually after the installation is completed. As an unsuccessful activation results from unsuitable server configurations in most cases, we now start from making configuration right.

Make Sure the Server Is Properly Configured

To allow URL rewriting, the rewrite engine for the web server must be turned on. In a shared hosting environment, it is probable that you need to contact your hosting provider to ask them to do the job for you.

Server ConfigurationFor an Apache web server, mod_rewrite module must be installed and enabled. Besides, you also need to check whether .htaccess file is included in your Drupal installation.

A sample .htaccess file is contained in a standard installation, but if you install Drupal manually, you may forget to copy the file to your server due to the a-little-bit-strange file name.

Enable Clean URLs in Drupal 7

Enabling clean URLs in the Drupal admin panel is simple, with several clicks required only. When you have logged into the dashboard, follow the steps below.

  1. Locate Configuration in the main menu and click on it.
  2. Find the section for Search and Metadata and click on the link for Clean URLs.
  3. Search and Metadata - Clean URLs

  4. Tick the checkbox before Enable clean URLs and click on the Save configuration button.
  5. Enable Clean URLs

The steps above work only when your site passes the clean URL test. Sometimes you cannot get the test running properly and the page may just refresh itself but does not lead you to any new page. In this case, there is a trick – you can visit the clean URL admin page which will get you a checkbox for enabling clean URLs. Note that there is no query string “?q=” in the address of the admin page. Misuse can lead to a negative result.

Now that you have changed the URL structure, check the pages on your site to see whether the changes have come into effect. If everything is right, you can stop here, but there might be another result – many errors appear when you try to access your site.

When an error happens, you may not be able to access the admin panel again to undo the configuration. At this time, you have to manually disable clean URLs and then check your server configuration again.

Disable Clean URLs

Disable Clean URLsIn the situation that you are locked out of administration due to clean URL issues, you can disable clean URLs by following the steps below.

  1. Use to log into your site. You may receive a 404 error as clean URLs are still in use.
  2. Visit, which will show you the clean URL admin page with a checkbox that allows you to disable the feature.