Last updated October 30, 2015. Created on January 9, 2005.
Edited by calbasi, rhm5000, mgifford, firfin. Log in to edit this page.

On this page:

General Information

By default, Drupal uses and generates URLs for your site's pages that look like "". With so-called clean URLs this would be displayed without the "?q=" as "".

The style of URLs using "?q=" can be hard to read, and may even prevent some search engines from indexing all the pages of your site. Research suggests this may not be as big of a problem for major search engines as it once was; however, it is worth noting the recommendation from Google's webmaster guidelines stating:

If you decide to use dynamic pages (i.e., the URL contains a "?" character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.

If you are unhappy with the default URLs in Drupal, you may be able to tell Drupal to use "clean URLs", eliminating the "?q=" in your site's URLs, and this page explains how to do it. The instructions below are largely applicable only for the most common server setup, which is an Apache web server running on some flavor of Unix/Linux, with the mod_rewrite Apache module (this link is for Apache 2.4) configured and mod_rewrite enabled in httpd.conf configuration file. If you are running Drupal on a different type of server, check the links section below (just above the Comments section of this page) to see if there might be something that addresses your server configuration on a different page.

Before enabling clean URLs in the Drupal configuration screens (see below), you may need to prepare your server for clean URLs to work. There are two ways to prepare your server for clean URLs to work in Drupal. If you have complete control of your server, for example: You run your own server; are installing a development site on your personal computer; or you have a dedicated server hosting account, then you should enable clean URLs in the httpd.conf file for better performance and security. However, if you have a shared hosting account (at DreamHost, BlueHost, HostGator, GoDaddy, 1and1, et al.), you will not be able to modify the httpd.conf file and should use the Drupal .htaccess file instead.

Clean-Urls Test - False Negatives

On some setups the Clean Urls test gives a false negative result. If you can visit Clean Url links like and Drupal returns the user login page, then .htaccess and mod_rewrite are working. Visiting the Clean Urls admin page directly at, should give you a checkbox that lets you enable Clean Urls (note the lack of "?q=" in the URL). See Note: If Clean Urls like stops working (switching hosts) you can visit the same page by changing the URL to look like:

Enabling Clean URLs in Drupal

The standard Drupal installation contains a sample .htaccess file that supports Clean URLs, so make sure this file exists before enabling Clean URLs. Before copying this file make sure there is a dot , in the .htaccess file's name. It is very important to how Apache works.

Drupal 8.x

In Drupal 8, clean URLS are enabled by default and can't be disabled. You will need some form of rewrite module installed on your web server.

Drupal 7.x

In Drupal 7, the installer tests for compatibility with Clean URLs as a part of the installation process. If the environment is tested as compatible with Clean URLs, it will be enabled as part of the installation process and no further action is required to enable Clean URLs.

If you need to enable Clean URLs post installation, Drupal will run the clean URL test automatically when you navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata > Clean URLs), show the results, and allow you to save configuration.

You can enable or disable it at a later time by following these steps:

  1. Navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata > Clean URLs)
  2. Wait for the automated Clean URLs test to run.
  3. Check or uncheck the Enable clean URLs checkbox
  4. Click "Save configuration"

Even if Clean URLs are successfully enabled at install-time, if you have a dedicated server you may still want to follow the steps (below) to enable the more efficient httpd.conf rewrite method for clean URLs. If you choose to do that, you might want to turn off Clean URLs while you are working on the server.

Drupal 6.x

In Drupal 6, the installer tests for compatibility with Clean URLs as a part of the installation process. If the installer was not able to run the test successfully at install time, you can later follow the instructions below for Drupal 5 to get Clean URLs working. There is one minor difference: Drupal 6 will run the clean URL test automatically when you navigate to the Clean URLs configuration page and will show the results, in place of giving you a link to run the test manually.

Also note that even if Clean URLs are successfully enabled at install-time, if you have a dedicated server you may still want to follow the steps (below) to enable the more efficient httpd.conf rewrite method for clean URLs. If you choose to do that, you might want to turn off Clean URLs while you are working on the server.

Drupal 5.x

Here are the steps necessary to enable Clean URLs in Drupal 5:

  1. Go to the Clean URL's (Administer > Site configuration > Clean URLs in Drupal 5) section of the administrative interface.
  2. Look for the paragraph that reads as follows:

    This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL.) Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The handbook page on Clean URLs has additional troubleshooting information. Run the clean URL test.

  3. Click on the Run the clean URL test link at the end of the above paragraph.
  4. If the test is successful, set Clean URLs to "enabled" and save the configuration. If the test is not successful, use the steps below to fix your server configuration and try again.

Prior to Drupal 5.x

For Drupal versions prior to Drupal 5, there is no automatic Clean URLs test or link. Instead, you can test manually by typing in the Clean URL for your settings page: (where is replaced by your hostname). If this results in seeing the settings page, and no errors, then Clean URLs are safe to enable, and you can do so with the setting on this page. If there is an error, follow the instructions below to configure your server.

Error recovery

Enabling "Clean URLs" when your server is not properly configured (i.e. if the Clean URLs tests described above fail) can make it difficult to navigate back to administration pages to undo your mistake, because all the Drupal-generated menus and links will have URLs that do not work. If you find yourself in this situation, you can return to the administrative settings page by typing in the URL in the 'non-clean' form: for the admin settings page in Drupal 4.x, or to get to the Drupal 5 or Drupal 6 Clean URLs settings page, or for Drupal 7 you can go to Once there, you should be able to reset to not using Clean URLs.

There are additional instructions for recovering from malfunctioning Clean URLs the Handbook page Unset clean URLs.

Server configuration for Clean URLs

You can read more about other web server requirements

Server configuration for Clean URLs on a dedicated server, with httpd.conf

Enabling clean URLs on a dedicated server involves these steps:

  1. Enable mod_rewrite for Apache. You can talk to your web host or consult the Apache documentation for mod_rewrite to get more information on how to do this. At a minimum, this will involve making sure that mod_rewrite is enabled for your installation of Apache.

    To test if mod_rewrite is available in Apache2, you can type the following at a command prompt, to list all installed Apache modules:

    apache2ctl -M

    On some systems this command may be:

    apachectl -M

    In the output, check to see if the rewrite_module is included in the list of modules.

    If the rewrite module is not in the list, it will have to be either compiled-in or made available as a loadable module. Generally speaking, you can tell Apache to load the module by including

    LoadModule rewrite_module modules/
    AddModule mod_rewrite.c

    in your Apache configuration file (see below for information on the configuration file). Be sure to uncomment AddModule mod_rewrite.c, if it is in your configuration file but has been commented out. The following may work to enable the module without editing any files:

    a2enmod rewrite

    Note that these approaches may not work for all combinations of operating system and Apache server -- consult the Apache documentation that came with your Apache software for the correct syntax.

    Remember to restart Apache for the new configuration to take effect.

  2. The next step is to locate the appropriate Apache configuration file for your site. Depending on your server configuration, the appropriate Apache configuration file could be httpd.conf, a virtual-host-specific file (vhost.conf), a specific site file (e.g. "default"), or apache2.conf. They are usually located in /etc/httpd/conf, /etc/apache2, or a sub-directory; if not, try the command:
    find /etc -name httpd*
    find /etc -name apache2*

    to find the file if it is located elsewhere in your file system.

    If you do not have write permissions to these files, and Clean URLs are not working out-of-the-box for you, you may have to ask your systems administrator or hosting provider for help. You may still be able to read these configuration files to troubleshoot a little however.

  3. The next step is to copy or include the Drupal-specific settings directly into your configuration file. There are instructions here for how to include the Drupal directives in your configuration file. Consult the .htaccess file in Drupal for examples of rules, such as the following for Drupal 6:
    <Directory /var/www/>
      RewriteEngine on
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    Similar rules for Drupal 7 and 8 are:

      RewriteEngine on
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteRule ^ index.php [L]

    Or this example on a Debian 8 + Apache2 + ISPConfig, using wildcard to match all sites installed:

    <Directory /var/www/clients/*/*/web/>
       RewriteEngine on
       RewriteBase /
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    Make sure that you are looking at the .htaccess file for your major version of Drupal (i.e., 7.x, 6.x, 5.x).

Note: If you do not want to put the rewrite rules in your Apache configuration file, you can still simply use the Drupal .htaccess file (as you would if you were on shared hosting). You will need to have the Allow Override directive set in your Apache configuration file (this will allow local .htaccess overrides on your site):

AllowOverride All
AccessFileName .htaccess

Read Behind the scenes with Apache's .htaccess for a thorough review of .htaccess. You may also find it helpful to view samples of Apache 2 AllowOverride directives.

Note Regarding MultiViews: Apache supports a feature called "MultiViews" (more generally: "Content Negotiation"), which allows navigation to your pages without the need for file extensions. For instance, if you had a file called "evaluation.txt", a MultiViews-enabled site could access this file with the URL "". While MultiViews can be a handy feature when used knowingly, it can cause problems when Drupal's Clean URLs are enabled. Unless you know what you're doing, you should not use MultiViews if you plan to use the Clean URLs feature of Drupal. However, MultiViews is not enabled in a default Apache installation, so it is likely that this note will not apply. Consult the Apache documentation for further information about MultiViews.

Server configuration for Clean URLs on a shared server, with .htaccess

The standard Drupal installation contains a sample .htaccess file which should be sufficient to get Clean URLs running. It is easy to miss copying this file, because of the leading "dot". So before trying to enable Clean URLs, make sure this file exists in your Drupal installation.

To check for this in terminal, use ls -a to make sure the "dot" files are also listed.

If you have this file installed, but Clean URLs still do not work, you can try some of the troubleshooting suggestions below. If you still cannot get Clean URLs to work, contact your hosting provider.

Clean URLs on Windows servers with IIS

Starting from Drupal 7, the package includes a basic web.config file for use with IIS.
See this article for more information and setup instructions.

Fixing problems

Check that .htaccess is even being used

Apache needs to be explicitly told to respect the instructions in your sites .htaccess file. This is off by default, though most hosts will have turned it on. That is what the AllowOverride All directive above does - it makes .htaccess start working.

To check if your host is currently even reading your .htaccess, you can (temporarily) add some garbage string to the file in an attempt to break it. Your site should immediately start returning a "500 Server Error" when you load a page from that directory due to this misconfiguration. (Remove the garbage string immediately.)

If you do this, and your site does not break - then .htaccess is being ignored and you will not be able to use clean URLs until you get support from your hosts, or enable it in httpd.conf as described above. Some hosts allow you to enable this option through their site management control panel, so look there first.

RewriteBase setting

The main configuration option which may need to be changed for your site is the RewriteBase. This can be specified in the Drupal .htaccess file or in the httpd.conf file, depending on where you are putting the Drupal rewrite directives (see above). By default, the RewriteBase setting is commented out of the Drupal .htaccess file, and that works well for many configurations.

If you are having trouble getting Clean URLs to work, you may need to change this setting. For example, if your Apache DocumentRoot is /var/www/ (i.e., /var/www/index.html is what is displayed when you point your browser at and your Drupal installation is installed in the subdirectory /var/www/mysite/, then the RewriteBase could be set to

RewriteBase /mysite

and that might help. In some configurations, setting
RewriteBase /

will allow clean URLs to work.


You may need to manually set the $base_url variable in the settings.php file if not already set. It's currently known that servers running FastCGI can run into problems if the $base_url variable is left commented out (see


RewriteBase works when your Drupal installation serves only one site, or when all the sites it serves are in the same subdirectory of their domains. For example,

RewriteBase /

will work for the following sites:

RewriteBase /mysite

will work for the following sites:

However, if your sites are in different subdirectories, RewriteBase will not work. You will need to create a special rule for each subdirectory. For example, your Drupal installation may serve the following sites:

In order to enable clean URLs for both sites, you will need to add

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/mysite/
RewriteRule ^ /mysite/index.php [L]

before the existing rewrite rules.

Location of index.php

For some server configurations, another change to the Drupal .htaccess file may be necessary. Find a line that looks like this, near the end of your Drupal .htaccess file:

  RewriteRule ^ index.php [L]

You may need to replace index.php with the URL path to your Drupal installation's index.php file (only the part after the base URL). For instance, if your site's home page URL is, you might need to use /subdir/index.php instead of index.php. If your site's home page URL is, you might need to use /index.php instead of index.php. This is necessary on some, but not all server configurations.

Create Even Cleaner URLs with the Path Module

Using Clean URLs will cause Drupal to generate URLs in the form "" In order to change the 'node/##' portion of the URL to something more like 'news/june-1st-news' a site will need the Path module enabled. See the Path module handbook page for more information on using the path module.

Looking for support? Visit the forums, or join #drupal-support in IRC.


j26crowley’s picture

Just thought that It would be good to mention that you need to have a VirtualHost setup in your apache config.
When I did fresh install of apache on ubuntu server 8 I had to first make a static link to the rewrite.load file

as admin I ran the command
a2enmod rewrite

Had to setup a virtual host for my domain name

NameVirtualHost *:80

<VirtualHost *:80>
ServerAlias *
DocumentRoot /var/www/drupal6/

restart apache

/etc/init.d/apache2 restart
Andrés Chandía’s picture

Fedora Core 4
Apache 1.3
Multisite (Many web applications, 4 moodle sites and drupal)
web directory /www/moodle1 - /www/moodle2 - /www/webappx - /www/drupal - etc)

I just added next lines at the server httpd.conf file and it worked

# for drupal, added by achandia
<Directory "/www/drupal">
  AllowOverride All

restart apache
/etc/init.d/httpd restart

I hope this helps.


pinenut’s picture

I set a virtual host as follows and now I can have 'Clean URLs' work.
For some reason, the same setup did not work with Drupal-6.17.

<VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs/drupal-6.16
    ErrorLog logs/
    CustomLog logs/ common
<Directory "/opt/lampp/htdocs/drupal-6.16">
   RewriteEngine on
   RewriteBase /drupal-6.16
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
tsuchan’s picture

pinenut> I set a virtual host as follows and now I can have
pinenut> 'Clean URLs' work. For some reason, the same
pinenut> setup did not work with Drupal-6.17.

I've just updated to Drupal-6.17, and configured according to the instructions. It worked for me. I've got two suggestions:

  1. You've got "drupal-6.16" in your DocumentRoot, Directory and and RewriteBase. Have these directories been renamed to drupal-6.17 during your upgrade?
  2. Try moving the </VirtualHost> line to underneath </Directory>, so that the Directory section is embedded in the VirtualHost.
phpcore13’s picture

Hi Friends,

I am using Zend Server Community Edition (Windows Version - Windows 7) and I have set Virtual Host on httpd-vhosts.conf like below

DocumentRoot "full/directory/path"
ServerName drupal.local

Options All Includes +Indexes +ExecCGI +FollowSymlinks
Options FollowSymlinks
AllowOverride All
Allow from all

ErrorLog "logs/drupal.local.log"
CustomLog "logs/drupal.local.log" common

I have also set "AllowOverride All" in httpd.conf file.

Still problem exist of Clean URLs.

Zend Server Community Edition (Windows Version - Windows 7)
Apache 2.2
PHP 5.3

Please consider this as an urgent issue.

kojak99’s picture

(1) Run the command a2enmod rewrite on your ubuntu (Command Line Interface) CLI to make sure rewrites are installed.

(2) vi /etc/apache2/apache2.conf

a. Under all the AllowOverride All

(3) In the .htaccess file under /var/www/ if that is your place of drupal installation make sure the Rewritebase / is uncommented and correct. If your drupal installation is **Rewritebase /var/www/drupa**l, then change it to that.

(4) Run command service apache2 restart on your ubuntu CLI and you should be good. * Optional - make sure your root

~Good Luck

mokko’s picture

on a drupal regular multisite clean url will not work without .htaccess in each project root, so make sure to copy also .htaccess


Hope that helps anybody

dannychang’s picture

DreamHost users have to use following code in .htaccess for clean URL

I haven’t test on godaddy and blueshot, but they should work the same

<IfModule mod_rewrite.c>

   RewriteEngine on

   RewriteBase /

   RewriteCond %{REQUEST_FILENAME} !-f

   RewriteCond %{REQUEST_FILENAME} !-d

   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

sunward’s picture

As a further update on anyone using godaddy:
I have a deluxe hosting with many sites. Using ftp, I edit the .htaccess file for the directory I am loading drupal in. At the bottom, remove the comment symbol to show the following

<IfModule mod_rewrite.c>
   RewriteEngine on
# big bunch of comment lines
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_URI} !=/favicon.ico
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

The line with favican.ico was there. Even though I am using a subdirectory, I didn't need to change any of the lines. Save and check clean url's. Should work right away.
lucyconnuk’s picture

Thanks, this also solved the problem for me.

Just to clarify, this is the .htaccess file in the Drupal root directory.

In the section of code which reads:

  # Pass all requests not referring directly to files in the filesystem to
  # index.php. Clean URLs are handled in drupal_environment_initialize().
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

.. the last line was changed to:

  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
lpolanco’s picture

After moving my site from an "Economy" to a "Deluxed" Godaddy's account (shared with another site), Clean URLs didn't work as before the moving, after days trying to find the answer I just figured out:

I change the following line in the .htaccess:
(exactly how it comes by default in your drupal installations files):

RewriteRule ^ index.php [L]

so it would now be:

RewriteRule ^ /index.php [L]

(note the slash "/" in front of "index.php [L]"

after that it would look like this:

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ /index.php [L]

Some systems need index.php and others need /index.php in order to work further than the Drupal front page when Clean Url is not enabled.
I hope it helps
I also noted that: when this line is missing or commented drupal can not change from "Clean URLs"

foxs’s picture

Fixed clean URLs immediately. No probs so far. This is in my subdomain root .htaccess for this particular Drupal install.

staceyb’s picture

Thank you, I had been trying to find this feature and the above works on Bluehost. If you're unfamiliar about how to get to this file (I had to learn today). cPanel -> File Manager and in the popup, choose your root of your Drupal site and before you hit Go, there's a checkbox to show hidden files. Click that, then on the next page you can edit your .htaccess file and add the code.

hanksterr7’s picture

Changing to RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] in my bluehost site made clean urls start working in my d6 site. With this change, and everything else as default in php.ini, .htaccess and settings.php, the clean urls test page started reporting that the system now supported clean urls.
Thanks so much!

SethVIII’s picture

For 1And1 with PHP 5, only change needed is:
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

Found solution here:

AlexanderPop’s picture

#LoadModule rewrite_module modules/
will have
LoadModule rewrite_module modules/

strands’s picture

This edit is also required in uniserv 4.0.

Edit the file
[drive][path]\Uniform Server\udrive\usr\local\apache2\conf\httpd.conf

Change line 194
#LoadModule rewrite_module modules/
LoadModule rewrite_module modules/

See for more tips.

Versions prior to 4 already have the rewrite_module line uncommented.

zagnutts’s picture

I wanted to share my problem with getting clean urls to work in ubuntu. I couldn't find any info on how to do this, but finally I pieced it together and it is actually very simple. Just do the following:

1)enable rewrite module on apache.
a2enmod rewrite
(to disable type a2dismod rewrite)

2)Set directory permission.
You must find the file that sets permission of each directory for apache. In my case it was /etc/apache2/sites-enabled/000-default
edit the page so that the directory that you will be using to serve webpages has "AllowOverride All". My file contains the following:

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

3)Just restart apache and it should be working:
/etc/init.d/apache2 restart

alaca’s picture

I followed Method 2

You have to enabled the rewrite module(mod_rewrite)

sudo a2enmod rewrite

My Drupal Installation serves one site which is in the subdirectory Drupal6

Hence my site address is http://localhost/drupal6

1st step

With Apache version 2, the httpd.conf has been deprecated (actually mine is empty ), and the new file is located at: /etc/apache2/apache2.conf

So, in the command line type:

sudo  /etc/apache2/apache2.conf

Copy paste following lines in the directory section, if it doesn't exist, just copy paste the lines at the bottom , and save the file.

<Directory /var/www/localhost/drupal6>
AllowOverride All

2nd step

sudo nano etc/apache2/apache2.cnf

Copy paste the following lines and save the file

RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 3

3rd step

sudo nano /etc/drupal/6/htaccess

Under rewrite rules make sure the following lines exist otherwise copy paste them , make sure to replace /drupal6 in line 4, /drupal6 in line 7 and /drupal6 in line 8 by your site's directory otherwise it won't work. Save changes.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule "(^|/)\." - [F]
RewriteBase /drupal6
RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} ^/drupal6/(.*)$
  RewriteRule ^(.*)$ /drupal6/index.php?q=$1 [L,QSA]

4th step

Reload apache

sudo /etc/init.d/apache2 reload

5th step

Enable url rewriting at /admin/settings/clean-urls
save changes

Dokuro’s picture

Easier way?

sudo gedit /etc/apache2/sites-available/default

Find every occurrence of "AllowOverride none" and replace with "AllowOverride All" then save and restart your server.

sudo /etc/init.d/apache2 restart
sudo service apache2 restart

Also, you need to change the RewriteBase line in the htaccess file in your drupal folder in order to get clean urls working (Ubuntu 10.04).

Example, my install is /var/www/html/

cd /var/www/html
sudo gedit .htaccess

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at uncomment and
# modify the following line:
RewriteBase /html

Seems to work for me.

benitezv1ang’s picture

this work for me in the .htaccess file
place full website url in RewriteRule

example: RewriteRule ^(.*)$$1 [L,QSA]

RewriteBase /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$$1 [L,QSA]

maku520’s picture

I installed Drupal (6.9) in a subdomain using GoDaddy hosting. I was initially unable to use clean URLs.

First I changed the RewriteBase directive to "/subdomainfolder". That didn't work.

Next, I added the "AllowOverride All" and "AccessFileName .htaccess" directives to the .htaccess file but that only produced a 500 error.

Lastly, I commented out the "AllowOverride All" and "AccessFileName .htaccess" directives and added a "/" in front of "index.php" in the line reading "RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]" to make it "RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]"

That worked.

xxvelcrar’s picture

In Debian, when you want to use clean URLs with a subpath you can do it in the following way:

  <Location /mysubpath>
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^/usr/share/drupal6/(.*)$ index.php?q=$1 [L,QSA]

This will give you a Drupal site at

Make sure to update the RewriteRule line with whatever version of Drupal you happen to be using.

geoff_eagles’s picture

AddModule used to be used to control the order in which you enabled the different Apache modules. However as of Apache 2.0 the directive AddModule is no longer required (pop to the apache site for a full explanation) so there's no need for
AddModule mod_rewrite.c
unless you're running an older Apache.’s picture

Not only it is not required, see:
but it seems it may provoke an error:

$ sudo service apache2 restart
Syntax error on line 7 of /etc/apache2/conf.d/drupal-7.0.conf:
Invalid command 'AddModule', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed. Web site creation.

obrigado’s picture

Network Solutions hosting is a complete disaster, but if you're stuck with it the following post helped me get Clean URLs working in a D6.10 install.

This only applies to the shared unix hosting package, where PHP is run through CGI.

In short, you need to create a php.ini file in the /cgi-bin folder at the root of your Network Solutions directory.

Fill the php.ini with the settings from the IfModule mod_php5.c section of your Drupal install's .htaccess. You can't just cut and paste because the ini format is parsed differently than .htaccess.

In D6.10, your php.ini file should looks like this:

register_globals = off
magic_quotes_gpc = 0
register_globals = 0
session.auto_start = 0
mbstring.http_input = pass
mbstring.http_output = pass
mbstring.encoding_translation = 0

Then you need to set BOTH the RewriteBase in your .htaccess file, and the $base_url variable in your site's settings.php file.

Go back to the clean urls admin page, and you should be able to flip the switch.

Some have reported that you need to comment out the Options +FollowSymLinks setting in your .htaccess file, but I haven't had to do so.

It's also worth noting that you won't be able to make it through the install process without errors without setting up a php.ini file as described above to disable register_globals.

stupiddingo’s picture

I can confirm this still works to enable Clean URLs for Drupal 6.20 in the root directory on Network Solutions Unix Hosting. For subfolder installations Clean URLs will work without configuration changes, but for a root directory install you'll need to uncomment line 107 in .htaccess

  RewriteBase /

And create a php.ini in /cgi-bin with the following:
magic_quotes_gpc = 0
register_globals = 0
session.auto_start = 0
mbstring.http_input = pass
mbstring.http_output = pass
mbstring.encoding_translation = 0

Thanks obrigado!
BrianLewisDesign’s picture

Network Solutions... not awesome for Drupal 7. All files uploaded with FTP get wrong permissions by default. You need a bunch of custom server settings to get Drupal 7 working without 404, 403, forbidden, admin access denied, and clean URLs, memory limit, or session errors. They have wasted a couple days of my time this week. I read that they are slow and oversell shared hosting, but I am still under development, can't confirm that yet.

Drupal 7 settings for network solutions:
php.ini (in the cgi-bin directory above the htdocs web root folder)
Lots of fun server settings here.

register_globals = off;
upload_max_filesize = 20M;
post_max_size = 96M;
memory_limit = 128M;
output_buffering = 2048;
magic_quotes_gpc = 0;
session.auto_start = 0;
mbstring.http_input = pass;
mbstring.http_output = pass;
mbstring.encoding_translation = 0;

.htaccess (in drupal install directory)
Use drupal default .htaccess, and uncomment the RewriteBase including your folder name if it's a subfolder of htdocs.

RewriteBase /myfolder

settings.php (755 the permissions temporarily so FTP works)
Comment out the $cookie_domain, and uncomment the $base_url and put your URL.

$base_url = '';  // NO trailing slash!

Hope this saves some time.

KEM827’s picture

In I tried updating .htaccess, php.ini and even redefined the $base_URL in settings.php, but Clean urls would not enable. I found in the settings.php code $GLOBALS['conf']['clean_url'] = 0. By updating existing code or adding this to $GLOBALS['conf']['clean_url'] = 1 in the settings.php, my site now has clean urls.

Daniel_Warner’s picture

I just installed Drupal 6.10 in a subdomain hosted by doteasy.

I read for hours about Apache Modules and mod_rewrite in particular only to discover that getting clean URLs to work is very easy in this situation.
Maybe this will save you some time:

1. Make sure you include the .htaccess file with the rest of your Drupal files in the directory on the server. Obvious to some, but .htaccess files are hidden by default in OSX and not included in a standard drag-and-drop transfer from your local directory to an FTP client. Installing Drupal is 100% possible without the .htaccess file but enabling clean URLs in a shared hosting environment is not.

2. Uncomment line 101 of the .htaccess file -- the one that has the "RewriteBase /" command

rick.archibald’s picture

I moved an existing site to another server, but the clean URLs no longer worked. After spending umpteen hours trying to troubleshoot it, I found the problem. Apache has multiple references to the .htaccess file. The first is a "default" setting as follows (even though I had changed the AllowOverride to All, it had no effect because it was overridden later [see below]):

<Directory />
    Options FollowSymLinks
    AllowOverride None

The second reference actually overrides the default setting:

<Directory "/var/www/html">
    AllowOverride None

After changing that setting, my clean URLs were all bright and shiny again! :-) Probably a no-brainer for those who spend a lot of time in the httpd.conf file, but it escaped me because I kept referring to the default setting.

mbohner’s picture

I got this from and it worked:

In your httpd.conf uncomment
#LoadModule rewrite_module modules/

and add the following in httpd.conf with Directory config block, replace the path with the path of your Drupal installation:

Options FollowSymLinks
AllowOverride All
RewriteEngine On

Note: there is no "AddModule mod_rewrite.c" needed

ericpai’s picture

I just switched from running XAMPP to Zend Server CE on my localhost.
I had a drupal site using clean url's fine and now after the switch, clean url's don't work anymore.
I had to make the switch because xampp was so slow.

In the httpd-vhosts.conf file I have :

<VirtualHost *:80>
    DocumentRoot "C:\xampp/htdocs/drupal_shared/html"
    ServerName drupalsite.dr
    ServerAlias www.drupalsite.dr
    ErrorLog "logs/drupalsite-dr-error.log"
    CustomLog "logs/drupalsite-dr-access.log" combined

I'm using the same .htaccess file that drupal came with (Drupal 6.19).
In my httpd.conf file I changed lines:

#<Directory "C:\Program Files\Zend\Apache2/htdocs">
<Directory "C:\xampp/htdocs">"

    Options FollowSymLinks
    AllowOverride All
    RewriteEngine On

I'm running a multi-site configuration with separate databases.
My drupal sites are in C:\xampp\htdocs\drupal_shared\html

PHP is running as CGI now also. It wasn't before.

Can anyone help with this?


ericpai’s picture

Had to change AllowOverride none to AllowOverride All in file:///C:/Program Files/Zend/Apache2/conf/httpd.conf.
I was also getting this warning:
warning: date() []: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\xampp\htdocs\drupal_shared\html\sites\all\modules\token\ on line 40.
date.timezone was not set in C:/Program%20Files/Zend/ZendServer/etc/php.ini in
Changed it to date.timezone = "America/New_York"

powerserg1’s picture

Great Job!! This also works for 1and1 customers!!!

Clean URL .htacccess with DreamHost, GODaddy and Bluehost
dannychang - December 26, 2008 - 21:34
DreamHost users have to use following code in .htaccess for clean URL

I haven’t test on godaddy and blueshot, but they should work the same

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


Rennes’s picture

I had my head banging on the wall about this ... so easy.

Don't forget, if you installed your drupal under the ROOT, you have to change the RewriteBase to specify which root drupal is installed under.

Like this:
RewriteEngine on
RewriteBase /yoursite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

matreides’s picture

mod_rewrite & Virtualhosts on Mac OS X Leopard Server

After much trial and error (mostly error). I finally got Clean URLs working on my Mac server. However let me start off by station that my Leopard server does not run the stock Apache, but one that I built form the ports tree because the stock one is a rpita!!! when it comes to php customization. Plus Apple is rather slow to keep up with basic security updates on UNIX ports.

    RewriteEngine off
    <Directory "/Volumes/Data/web/">
        AllowOverride Options
        <IfModule mod_dav.c>
            DAV Off
        Options All -Includes -ExecCGI +MultiViews -Indexes
        RewriteEngine On
        RewriteCond %{REQUEST_METHOD} ^TRACE
        RewriteRule .* - [F]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

Thanks to this note I found on the Zend Framework Page regarding mod_rewrite which suggests placing a forward slash before index.php. I did try the tag but that did not work so I moved things around and well struck pay dirt. I shall test this on one of my FreeBSD web servers tomorrow morning and if it work I'll make another note.

I hope this saves someone hours of headaches from not having to knock their head on a wall...;-|

<VirtualHost *>
        DocumentRoot "/web/"
        DirectoryIndex "index.php" "index.html"
        CustomLog "/web/" "%h %l %u %t "%r" %>s %b"
        ErrorLog "/var/log/apache2/error_log"
        ErrorDocument 404 /error.html
        <IfModule mod_dav.c>
                DAVLockDB "/var/run/davlocks/.davlock100"
                DAVMinTimeout 600
        <IfModule mod_mem_cache.c>
                CacheEnable mem /
                MCacheSize 4096
    RewriteEngine off
        <Directory "/web/">
                AllowOverride Options
                <IfModule mod_dav.c>
                        DAV Off
                Options All -Includes -ExecCGI +MultiViews -Indexes
                RewriteEngine On
                RewriteCond %{REQUEST_METHOD} ^TRACE
                RewriteRule .* - [F]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
        LogLevel warn

Mikel King
faqing’s picture

sudo a2enmod rewrite
sudo nano  /etc/apache2/sites-available/default

Edit line 7 to read, "AllowOverride All".
Edit line 11 to read, "AllowOverride All".
Save and exit.

Find and Replace All "AllowOverride None" with "AllowOverride All".
Save and exit.

scifisi’s picture

Thought I'd report back.

It's been several hours now and 5 re-boots of my server just in case it was services not starting of something. I must have visited 20 websites and checked everything I could.

Finally I decided to download the trial version instead of the free 'Lite' version. Bam! Working straight away - I guess they don't want anyone to go without paying. I'm sure they deserve their money. I just wish someone would pay me for the hours of banging my head against a wall.

I'm very glad it's working. I just feel a bit flat after so much effort and so many angry thoughts running through my head.

robballan’s picture

1. make sure is checked on in Server Admin

2. if Server Admin on your system allows you to check "Allow All Overrides" in the Apache Options for your site, you're done. Otherwise...

3. edit /etc/apache2/sites/[0000_your_site_info.conf] (where 0000_your_site_info.conf is a filename corresponding to the site you have created in Server Admin -> Web -> Sites) and make the following change:

  • search for the <Directory "/Library/WebServer/Documents"> entry (if you haven't changed your site's root, otherwise look for the entry with your specified root)
  • change AllowOverride None to AllowOverride All
idebill’s picture

To get clean urls working with my Omnis hosting account, I had to remove the following from the standard .htaccess file:

# Follow symbolic links in this directory.
Options +FollowSymLinks

dagdag’s picture


I have a similar problem but when I transfer the site to the final server, it shows me a similar message so what I did was

- check if the rewrite module is enabled

prompt$apache2ctl -M
to see the apache modules

and as it was enable I add this code to my httpd.conf to allow clean URLs

# Various rewrite rules.
<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /home
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

this works for me. the /home is for my drupal installation location

drupal 6.14
Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.7 with Suhosin-Patch

bruceclothier’s picture

Hi. I get irritated every time I have to do this, so writing a note for me and for everyone else that it might help:

Setup LAMP on Ubuntu. Create symbolic link to phpmyadmin (just by the way because its annoying to remember):
Setup instructions here:
Creating link: sudo ln -s /usr/share/phpMyAdmin /var/www

Install mod_rewrite:

sudo a2enmod rewrite

Add this to conf (sudo gedit /etc/apache2/httpd.conf):

<Directory /var/www/fridays>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
   AllowOverride All

Restart Apache:

sudo /etc/init.d/apache2 restart

Hope that works straight away for someone. Took me 2 hours to work out.

querbach’s picture

Under "Multi-site" above, we find the following prescription:

In order to enable clean URLs for both sites, you will need to add

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

before the existing rewrite rules.

The $1 in the last line should be %1, since we want to take the back-reference from the last RewriteCond, not from the RewriteRule itself.

If we use $1, we get an extra "mysite/" in the query part of the URL. As an example, for /mysite/target-url we get:


With %1, we instead get


which is what we want.

iantresman’s picture

Having installed Drupal v6 in a subdirectory /drupal, I wanted to "move" the installation to the root, without having to move all the files up a level. After finding some great posts online, this could be done with a .htaccess file and a few other tweaks, mainly sourced from a post "Getting started with Drupal 6 in a subfolder". In a nutshell:

1. I created a new .htaccess file in the root, containing:

RewriteEngine on
RewriteRule ^$ /drupal/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ drupal/$1 [L,QSA]
(If your installation is in a different subdirectory, you will need to amend the two occurrences pointing to "drupal" to your subdirectory name)

2. I deleted the existing file in the root, index.htm, so that it would not be found and served up. You might also need to remove, if it exists, index.php (actually I renamed the files on the server, so that if I encountered a problem, I could rename it back, and continue with the old site)

3. In sites/default/settings.php, I changed the commented line to:
$base_url = '';  // NO trailing slash!

  • I did not need to make any changes to the existing Drupal .htaccess file.
  • I needed to log-in again to gain access to the site
  • I placed my site in Maintenance mode while making the change
MatthieuP’s picture

I struggled an hour before understanding that the test which allows to enable clean-urls which was failing.
I was modifying my configuration and was refreshing http://localhost/q=admin/settings/clean-urls , unable to enable it.
After validating that mod_rewrite was enabled, I guessed this auto-test was failing, and tried to reload my page at http://localhost/admin/settings/clean-urls . The test succeeded and I was able to enable clean urls :p

khosman’s picture

I just spent hours trying to figure this out - and finally got it to work trying something I haven't seen listed elsewhere:

I had been opening the httpd.conf file in dreamweaver - editing per instructions found here - then closing it. Turns out, Dreamweaver was adding something to the mix unbeknownst to me. Opening the httpd.conf file in notepad, editing and saving out that way suddenly made everything work. Here are the only changes I made:

1) Per an earlier message in this thread, I removed the hash (#) mark before the following in the .htaccess file:
RewriteBase /
2) I removed the pound sign/hash mark/# before the following in the httpd.conf file:
LoadModule rewrite_module modules/

After saving each of those files, (again, editing in notepad as opposed to dreamweaver) I simply restarted "all services" and refreshed the "clean urls" page on my site and was able to enable clean urls.

Note: I made no other changes; other suggestions/coding found in this thread were unnecessary for my setup (wamp, windows xp home, apache 2.2.11, php 5.3.0, drupal 6.15)

marsd’s picture

trying to get the Clean URLs page at Home > Administer > site configuration to work properly so the radio button for ENABLED would work. I finally got- "your server has been successfully tested to support this feature"

using Windows XP, WampServer2.0h.exe, MySQL 5.1.33, PHP 5.2.9-2, Apache 2.2.11, Drupal 6.15

working on my local computer:
I found the file named httpd.conf at C/wamp/bin/apache/apache2.2.11/conf
Opened this file using Notepad and removed the # marks from the line that reads - LoadModule rewrite_module modules/

Then I added to httpd.conf as stated above while changing the directory as follows to read:

<Directory /var/www/sites/default>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
maxrossello’s picture

Thank you!
I would have never suspected that using http://localhost/?q=admin/settings/clean-urls reported a wrong result, while http://localhost/admin/settings/clean-urls succeeded!

For this reason I did not understand your instructions immediately. So more clearly, what I did after restoring mod_rewrite is just changing the URL in the browser.

mt3ch’s picture

In Drupal 7 the above comment was the answer that saved me. I was following every piece of advice that seemed appropriate and clicking the clean URL test button to no avail (took about 4-5 hours on solving this problem).

After reading the above comment and simply editing the browser URL manually to a clean URL I finally see it does work and I now see the "enable clean URLs" checkbox.

This isn't a good situation, though, as working clean URLs should be detected by Drupal and it should not keep reloading the page asking the user to press the test button. I hope this can be fixed in future.

Anyway, I'm glad my struggle is now finally over! Thanks to all who posted solutions.

Jennifer_M’s picture

Thanks people - this was the threadlet which rescued me from a dead end!

I've done a bug report,

raffamaiden’s picture

For projects hosted on Sourceforge, you will need to uncomment the following line from the standard .htaccess file

  RewriteBase /

and then copy .htaccess in your /home/groups/f/fo/fooproject/htdocs folder, where "fooproject" is your project UNIX name.

aosiname’s picture

My Scenario:

Using multisite in that I have a main installation of Drupal on my server in /drupal

Created 3 sites to run off a single codebase by doing the following:

Create the following sub directories (note the final directory should match the domain name without the "www"):

* /drupal/sites/
* /drupal/sites/
* /drupal/sites/

Created a MySQL database for each site and copied the default.settings.php file from drupal/sites/default into each of the directories created above.

Renamed each instance of default.settings.php => settings.php and input the corresponding database login details so could connect to its own database and could connect to its own database and...

Visited to install and repeated for the other two sites.

Read many articles that claimed clean urls would only work if I made a reqrite rule for each site in the main .htaccess file.

No need for that on my server. The only two changes I made were to declare the drupal code directory like so:

### Declare drupal directory ###
RewriteBase /drupal

And changed:
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] => RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
- note the "/" in the latter.

Clean URLS is now working on all three sites.

Through my testing, I must have broken the .htaccess file so I re-downloaded drupal, copied the .htaccess file and made just those two changes and it worked.

My file is attached as a .txt here if you need it as a reference point.

xmariachi’s picture

the text mentions it removes the query parameter, but it does not say what is the expected format of your URL for a regular node.

I'm finding that to be, for a default install (e.g. no additions to the URL like the country name ../es/.., etc. ) :
such as
just as the nodes on the site.

I'm looking for SEO friendly URLs for a blog or forum. Is this module addressing this problem?

La escupidera - Blog de xmariachi

jakery’s picture

Mostly, they work. However, on

On the main page, if you scroll to the bottom and click one of the "next page" links, the rewrite rule doesn't take effect. Instead of getting

I get

which produces a broken link.

I'm hosted on GoDaddy and these are my .htaccess settings:

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


Please, anybody have Idea how to get It running on Windows+ IIS?


Sahin’s picture

Clean URLs on IIS (

alulema’s picture

Hi all you guys,
I've trying this for about a week unsuccessfully (maybe I need a different point of view). My hosting is SeekDotNel, which provides PHP hosting over DotNetpanel (I mean any kind of .NET based manager over IIS), but it parse .htaccess a little bit weird b/c Rewrite* options are not enough for it, I mean it throws the following error:

DotNetPanel IIS Modules Error
AuthName directive not found.
File: C:\HostingSpaces\mainsite\maindomain\wwwroot\.htaccess

So I thought, in order to remove alert, it requires a kinf of authentication configuration like the following:

AuthType None
AuthName Unrestricted

But it neccesarilly demands AuthUserFile (AuthUserFile /sec.db) and my site turns in something unaccessible.

Any ideas? Thanks in advance.

Sahin’s picture

see Clean URLs on IIS (

marko3’s picture

I have problem setting up clean url for my nginx web server. I tried some hints here and there on blogs, but with no success. Regarding that a considerable portion of drupal sites run on nginx servers, I am wondering why the instruction is not included here yet, and I wish someone can do so.

Entero’s picture

Hello! Look at article
For my Drupal 7 started under nginx only that solution works - write in your /etc/nginx/sites-enabled/hostname.file something like:

location / {
        root /var/www;
        index index.php;
        error_page 404 = @drupal;

location @drupal {
        rewrite ^(.*)$ /index.php?q=$1 last;

This worked in early drupal 7.x versions. There is example for drupal 7.4 & nginx 0.8.54 - :

location / {
# This is cool because no php is touched for static content
try_files $uri @rewrite;

location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
rewrite ^/(.*)$ /index.php?q=$1;
mogop’s picture

Hi, I try both of your examples but still can't enable Clean Urls

nginx version: nginx/1.2.1
drupal: 7.12
PHP: 5.3.10-1ubuntu3.2 (more information)

any other ideas ?
dimedrol’s picture

pinenut’s picture

I was able to enable Clean URLs under Drupal 6.16.
But I can't under Drupal 6.17 with the same settings.

<Directory "/opt/lampp/htdocs/drupal-6.17">
   AllowOverride All

I also tried:

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

There must be some change in 6.17 that makes this problem.
What could that be?

l1khoa’s picture

u can see post " a fix that worked " above this post. I work D6.17 and this ok w me.

redlance’s picture

If you can't get the clean urls to work, you may just be missing the simple user path in your .htaccess file This is almost always the case.

instead of RewriteBase /

you need to add the ~user (user being the name of your cpanel account)

RewriteBase /~user

for those on hostgator you can find this on your welcome/setup email its very simple to because it is 99.9% going to be your cpanel username. Don't forget the ~ before it. You should not have to have any additional path after this just the /~user

beretta627’s picture

On Modwest you need to add:

RewriteBase /


RewriteEngine On

to get clean URLs working.

Rennes’s picture

I had my head banging on the wall about this ... so easy.

Don't forget, if you installed your drupal under the ROOT, you have to change the RewriteBase to specify which root drupal is installed under.

Like this:
RewriteEngine on
RewriteBase /yoursite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Differenti’s picture

Hello people, I really need help with this one.

Is there any alternative solution, even a far-fetched workaround, to solve this problem, other than the ones given above?

I have checked (it's on a shared server):
- the .htaccess file is present
- the .htaccess file is NOT ignored
- drupal is NOT in a subdirectory
- uncommenting RewriteBase / does NOT work
- changing RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] by adding an extra / does NOT work

I've found 100.000 solutions online but they all come down to these five points that I have checked over and over again.
Is there ANY other solution? I'm really pulling my hair out right now?


Pistachio Pony’s picture

Sometimes it works to do it all again step by step. To get my clean URL's to work I :
1. Downloaded the original .htaccess file to my computer.( it may show up as .htaccess[1] )
2. Opened it up with Wordpad instead of Notepad--Notepad shows everything jumbled up.
3. Found the '#RewriteBase / drupal' code and deleted the '#' and the 'drupal' so it looked like: RewriteBase /
4. Hit Ctl S to save it--Don't "save as" I think this messed me up the first time.
5. Uploaded it to server
6. Renamed the .htaccess that was already on server to '.htaccessOLD' in case I messed something up.
7. Renamed the .htaccess[1] that I just uploaded to .htaccess
8. Reloaded my wepage, logged on and went to Administration>Clean URL's and
Voila I was able to click the radio button for clean URL's.
I am a super newbie and have found my webhost 1and1 to be very helpful with my Drupal questions so far. I hope this helps.

Sahin’s picture

I'm testing D7 beta1 (on IIS) and confused a bit:
Q1. No problem till to the "Administer > Configuration > Search and metadata > automated Clean URLs test" step, but then no "Enable clean URLs checkbox" appears to check/uncheck. Any idea?
Q2. Which table/variable keeps this setting?
Q3. Does $conf['clean_url'] = 0; (or =1) in settings.php overrides this setting? I checked but observed no change.

ippy’s picture

One of our clients has a D6 site with hosting by British Telecom (BT) . We needed to make a single change to the last line of the Rewrite URL section in the .htaccess file in order to enable clean URLs (hosting package was "business, starter" I think). As noted in the "Location of index.php" section of the handbook:

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
# Add a / to index.php?q=$1 [L,QSA] to enable support on BT server
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

escoles’s picture

Note that the following will produce an error on some Amazon EC2 servers:

AccessFileName .htaccess

Just try doing without it -- in this case, I found it to be unnecessary.

hendrohwibowo’s picture

I see that clean url still makes a hot issue until 2010! i have my problem too

In my case, i have 2 drupal installation on fedora 12,
1. in document root -> http://localhost/drupal/ (in filesystem: /var/www/html/drupal/) and
2. in homedir http://localhost/~hendro/drupal2/ (in filesystem: /home/hendro/public_html/drupal2/)
(note: hendro is my fedora logon username)

clean url for the one in document root is working fine, but NOT in homedir.

i searched and searched the internet, and played around with the .htaccess file in /home/hendro/drupal2/.htaccess, with no luck

any help is appreciated


hendrohwibowo’s picture

i have solved it from drupal posting (Clean URLs in Mac OS X Server):

i use this RewriteBase line in the .htaccess file (the one in /home/hendro/public_html/drupal2/.htaccess):

RewriteBase /~hendro/drupal2

no need to restart apache, and it works.

thanks for everybody who post their problems and solutions in the internet!

jamhitz’s picture

Even after Googling endlessly, reading and re-reading the instructions over and over again and banging my head on the wall for two days in a row, I just could not get CleanURLs to work in Drupal 6.19 on OpenSuse 11.2... I did everything by the book. I even tried removing and then re-installing everything - apache2, php5, mysql... Nothing! I tried reverting to an earlier version of Drupal... Nothing!; changed versions of everything.. including modules. Nothing!! I even contemplated forgetting all about Apache... forever!!! and switching to something else (say Lighttpd or Nginx... Aaaarrgghhh!! (Couldn't just bring myself to that point... yet).

Finally, when I was about to bang my laptop on the wall and give up, I got it! Just follow the instructions in this page *except* DO not edit /etc/apache2/httpd.conf. Instead change AllowOveride All in /etc/apache2/default-server.conf. That's it. One line!!! Damn, how daft am I really?!!

Remember, if your install is in a subfolder off of the root (eg /srv/www/htdocs/site1/), then edit /srv/www/htdocs/site1/.htaccess, change RewriteBase from / to /site1.

I do not know about other distros, but just in case.... there you have it!

4l’s picture

Thanks a lot for this info. Just installed Drupal 7 on openSUSE 11.3 and was stuck at this point with the Clean URLs configuration page simply refreshing and showing nothing else each time I pressed the button. Thought I'd try this comments list from the bottom up since there's little relating to v7 already. Mercifully I found yours straight away, and I finally got it working.

In my case I have my primary site configured under a multi-site setup using virtual hosts, so I went into /etc/apache2/vhosts.d/{sitename}.conf and changed AllowOverride to All. Or in full, that file now reads:

<VirtualHost *>
DocumentRoot /srv/www/htdocs/drupal
ServerName {sitename}.localhost
<Directory /srv/www/htdocs/drupal>
  AllowOverride All
  Order allow,deny
  Allow from all

Restarted Apache and that was it. Seems fine now.

phillamb168’s picture

Just wanted to share a solution to a very specific problem with clean URLs - I was working on a site that used /entries as a path for a number of different pages, but they never, ever worked when Clean URLs was enabled. Views worked, admin worked, regular nodes worked, and I couldn't for the life of me figure out what the problem was.

Turns out, .htaccess has, at the very top of the file, the "FilesMatch" declaration. For my server configuration (and maybe on yours as well?) if you have a path that matches a string from the FilesMatch declaration, you'll get a 404 or 403. To fix it, simply edit the .htaccess file to remove the particular string between pipes, e.g., remove |Entries*| and |entries|

jpdw’s picture

I had the overlayed Clean URLs test dialog just reloading whenever I tried to enable clean urls.
No amount of trying the suggestions above seemed to be solving it (and my D7 is in my doc root so RewriteBase should be / )

In the end I tried calling the "dialog" page directly at http://hostname/admin/config/search/clean-urls
This time it seemed to work.

Not sure the fact the host is an EC2 instance may be significant (some network translation between the VM and inet?) or whether this is generic problem - I've not got another available host to try it on to validate.

fibric’s picture

exactly that solved my issues with clean urls.

i have no idea why the test did not redirect properly but going to http:///admin/config/search/clean-urls finally showed the check box :-)

i guess there is a little problem with redirect rule caused by not catching www and none www urls of the same domain. but that is just my thought.

Allen Katzors’s picture

I tried this with the wild card redirect and it worked for me. Many thanks. Make sure to check out my utility carts site here.

geetepunit’s picture

RewriteBase = /~username/directory_where_drupal_installed(if root leave it)

anaperes’s picture

Hello, I'm having a big problem with my website and I will need help.
I have clean url on drupal and everything was great until I notice drupal wasn't displaying in browser the right url, it was displaying and it was supposed to have
This page 'about' have another sub-page attacked in 'input format' and everytime I selected the rigth sub-page to be displayed there I save but drupal deselected it and I get nothing. Nothing on browser (clean url) and nothing on my view...
It was great one day on the other day I notice this... Can anyone help me????? Please????

I'm really losing my hopes about drupal....

juankvillegas’s picture

You must install Global Redirect

anaperes’s picture

I also have that. I have everything right...
My website was fine and working great. On the other day out of the blue, stoped working properly and I notice several issues!

SolomonGifford’s picture

We are having the same issue as johacami on March 1, 2011 at 11:31am.

postscripter’s picture

I used Bitnami stack. ( )
I have created two websites. In website 1 the clean URL is working fine
But the other isn't, when I put this link
I receive the following error
The requested URL /Program Files/BitNami Drupal Stack/apps/website2/htdocs/index.php was not found on this server.
I can only use this link

I highly need the clean url to work, for me to able to use contextual filter in views.

PeterNSteinmetz’s picture

Spent some time running down why Clean Urls weren't working on an Ubuntu 10.04 installation.

I also have a Mailman installation running on this site and the default ScriptAlias commands for Mailman would cause the Clean Url test to fail, even though all other items above checked out. Commented out the script aliases (accessing mailman at site/mailman instead) and Clean Urls work fine.

Presumably the test for Clean URL functionality uses a url under site/admin, which conflicts with the admin ScriptAlias for mailman.

gunthehun’s picture

On hostgator I struggled for quite a while with trying all the different sugestions here, until I had a good look at the .htaccess and at the bottom of the file found that the "RewriteEngine" switch was set to off. Just change it to on and it works :)

Hope this helps someone out there

WillGFP’s picture

I've been having trouble getting this to working with Drupal 7 on the host iPage (not recommended) for a while. Finally, I tried changing ".htaccess.txt" to simply ".htaccess" and everything works like a charm now.

kedyaugustin’s picture

I spent a great number of hours messing around with different solutions, on IPAGE you have to change ".htaccess.txt" to simply ".htaccess" . This worked perfectly, THANKS WIllGFP. Drupal 6.22

allanx’s picture

Re D7 and Clean URLs not working as per usual.

Answer for me was to download and install the Global Redirect module for D7:

Following installation I went to Clean URLs: admin/config/search/clean-urls to enable clean urls (this did not work before installation of /globaldirect module)

All works absolutely fine now.

Thanks! Hope this helps someone...

algeorge’s picture

I had to modify as follows before it would enable clean urls option in the admin setting for clean urls:
# RewriteCond %{REQUEST_URI} !=/favicon.ico
# RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
#the following mods were necessary for my localhost with directory var/www/radiospares
RewriteCond %{REQUEST_URI} !=/radiospares/favicon.ico
RewriteCond %{REQUEST_URI} ^/radiospares/(.*)$
RewriteRule ^(.*)$ /radiospares/index.php?q=$1 [L,QSA]

basant.gaur’s picture

I have just started working in drupal , I am running drupal 6.2 on windows , when I try to enable clean url , the radio buttons named as follows are disabled

Clean URLs:
I tried to enable these buttons by adding the following code in .htaccess file

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

but i am not able to make it enabled , drupal is running in the root directory

if anyone have any idea please mention the workable code


vamsi.avkr’s picture

Please try this one in .htaccess file

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

ycsoftware’s picture

Complete these steps in order and you should be ok’s picture

Rather than The following may work, it'd be better to say that a2enmod is a Debian script, as such working also for Ubuntu, enabling a module of Apache2 by creating a symbolic link in /etc/apache2/mods-enabled pointing to a file of the same name in /etc/apache2/mods-available. See
man a2enmod Web site creation.

premiero’s picture

After searching what is going, because I couldn't even enable Friendly URL's (there was no checkbox), I found solution. After clearing the cache in the admin/config/development/performance menu, the clean urls are finally working.

vamsi.avkr’s picture

I solved CleanURLs problem..

it is very simple

In .htaccess file just change

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]


toulon’s picture

Scratched my head on this for quite a while and found few things to pass on
Problem: Clean URLs not displaying check box to Enable clean URLs
Note: I have complete control over my web server so did not need .htaccess files and normally have to delete them or get "Internal Server Error" error message displayed

I use standard (pretty much default) httpd.conf settings with one change

# AllowOverride None
AllowOverride FileInfo
# Controls who can get stuff from this server.
Order allow,deny
Allow from all

Had to create an .htaccess file that only included (excluding normal comments) the following

RewriteEngine on

RewriteRule "(^|/)\." - [F]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at uncomment and
# modify the following line:
# RewriteBase /drupal
RewriteBase /joe1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Note: Easy test to see if Clean URLs is enabled (even if it fails when you try it).
After you think you have enabled it, or tried to, then hover your mouse over one of the menu icons and notice what the URL looks like. That is a big clue is you are moving in the right direction.

Also an easy way to set the Clean URLs setting is to do the opposite of the instructions located at

Hope this helps someone


teddyboar’s picture

As apache docs states:

AllowOverride Directive:
Only available in < Directory > sections.

AllowOverride is valid only in < Directory > sections specified without regular expressions, not in < Location >,
< DirectoryMatch > or < Files > sections.

What means it should be used in your virtual directory configurations. If you use the default site from the sites-enabled directory within /etc/apache2, or you copy it to your custom site to be it's default configuration (as I did), make sure to enable this directive in the corresponding fields to be able to use .htaccess files.
Secondly, in this case you have to disable Multiviews (what is Enabled by default) in these fields as well:

<VirtualHost *:80>
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
<Directory /var/www/>
Options -Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all

Relevant Apache version: Apache/2.2.19 (Debian) built May 22 2011 08:32:52

Jumoke’s picture

Changing RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule ^(.*)$ /drupal7/index.php?q=$1 [L,QSA]

in the .htaccess file inside my public_html/drupal7 folder works for me.

wcoastsands’s picture

Wanted to post this since I've seen nothing directly addressing this issue with relation to permission settings. So I've been beating my head over this for about a week trying to figure out why I was getting the error message "Your system configuration does not currently support this feature" for Clean URLs. As it turns out, if the Drupal installation directory is set to executable permissions only for other users (ex.: chmod 701 drupal), the .htaccess file will be inaccessible to the the Apache server. After setting the permissions to readable for other users (ex.: chmod 705 drupal), the server was able to access and read the changes made to the .htaccess file.

My initial reasoning for setting the permissions of the directory to 701 was to disallow browsing of directory contents for users other than the owner or members of the user group. Normally files within the directory would still be readable if their permissions allowed for it. However, it appears the Apache server is unable to either read the .htaccess file, or is simply unable detect its existence, when the read permissions for the containing directory are disabled.

Hope this helps someone else out there.

Chris_Hardie’s picture

If you run the clean URL test in Drupal on a site that is password protected via .htaccess or server configuration, the test page will reload without any kind of helpful failure message. The problem is that the url test is being initiated from the server on which the site is hosted, and when the server attempts to load the test URL, it's doing so as an unauthenticated user (in the htaccess sense, not in the Drupal user sense). The server will return a result code of "401 - Unauthorized" which the Drupal interface doesn't know how to handle.

The solution is to allow an exception in your htaccess file for the server to access the clean URL address. Any easy (but perhaps insecure) way to do this is to allow host-based access to the site, in addition to certain usersname/password combinations. By including the IP address of your hosting server, you can allow the clean URL test to succeed.


kifuzzy’s picture


xampp on a local machine win xp with virtual hosts.
making changes to http.conf in apache/conf to add
"LoadModule rewrite_module modules/"

check the .htaccess-file in drupal - root
- several, if you run in sites/default or with "multisite"
(may help)

!! i make it with virtual domains, so i only have to
type "test" in my browser to access the local - site !!
no matter if a drupal with only one in sites/default or
a drupal with multisite like "sites/test" "sites/test2" and so on.

file "hosts" configured in
like test

file "httpd-vhosts.conf" configured in

ServerName test
ServerAlias test
AddType text/html .shtml
AddHandler server-parsed .shtml
ServerAdmin webmaster@msd
DocumentRoot "c:/xampp/htdocs/drupal"

Options Indexes FollowSymLinks
Options +Includes
# Options +
AllowOverride FileInfo
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php index.shtml index.html index.htm

what i have forgotten was to make the changes in my
virtual host file of windows.
after checking "Allow Override All" is on there
(default was "NONE") clean-url works.

"Allow Override All" could be found on more than one place
or file - be sure of what you do! or make backups before
playing with these files!

Christopher James Francis Rodgers’s picture

The following relates specifically to my experiences with a Drupal 7.12
'shared-hosting' website (as opposed to an installation on-your-computer; and in my case the web-host is and the site was installed using SimpleScripts (an automated Drupal installation process via my webhost's control panel as opposed to FTP manual uploaded installation)
into a website sub-folder (I have never yet tried to install Drupal 7 in a domain's top lever folder);
and also addresses complications if that sub-folder was password-protected before the SimpleScripts installation.

  1. In the case of a SimpleScripts Drupal 7.7 installation into an empty or not-yet-existing sub-folder location, a file named .htaccess.txt is created at [Drupal_7.7-root]/.htaccess.txt, but you need to rename that file as .htaccess

  2. In the case of a SimpleScripts Drupal 7.7 installation into a pre-existing sub-folder that was also password protected prior to the SimpleScripts installation (and therefore that folder already has a small .htaccess file within it), no change is made to that original .htaccess file during the SimpleScripts D7 installation. And...

    • At times, (generally when I have never used the sub-folder name before), the SimpleScripts installation will add a file named .htaccess.txt to the root folder.

    • At other times (generally when I am re-using a sub-folder name again after having deleted the previous D7 installation from that sub-folder) I have seen No additional .htaccess.txt (nor any other variety of .htaccess file) added to the Drupal 7.7 root folder; in which case you need to acquire the large .htaccess file (137 lines of code) that is found by downloading the Core package *.tag.gz or *.zip file to your computer and extracting it.

Details follow.

1. SimpleScripts installation into an empty online sub-folder that is Not protected; or to a not yet existing sub-folder.

By default, when you install Drupal 7.7 with SimpleScripts and allow it to create the new sub-folder; or install D7 into a pre-existing empty folder, a file named .htaccess.txt is created at the top level of your Drupal 7 installation and No file named .htaccess is created.

If you try to enable 'Clean URLs', you will be unsuccessful.

Click the button 'Configuration' at your page top in the administration menu toolbar (This toolbar is present because the Core module 'Toolbar' is enabled by default), and on the page that loads, look under the heading 'Search and metadata' and click the link 'Clean URLs'.

If you click the button 'Run the clean URL test', it will return the exact same page-- no matter how many times you try.

To fix this problem, rename the file .htaccess.txt to .htaccess

If you have any problems renaming the .htaccess.txt file to .htaccess, it is likely because that file has a permission level of 0644. That permission number needs to be changed to 0777 before the file can altered. (Other numbers might work such as 0755, but 0777 has always worked for me) You can change any file or folder's permission level number by going to your web-host's Control Panel and using the 'File Manager' (or similar). Find the file. Highlight the file by clicking it, and then click the page-top button 'Change Permissions' (or similar). If you had to change the permission level of the file, remember to reset the permission for .htaccess to 0644 after you have successfully changed its name.

2011.08.09 - Note from Eric at BlueHost support: "... Also, just as a side note, using 777 permissions is never a good idea. Apache (our web server) actually blocks access to scripts with 777 permissions. 755 should be okay for anything you need to do." -Eric

If your site is in 'Maintenance mode', take it out of 'Maintenance mode'.

Return to 'Configuration' >> 'Search and metadata': 'Clean Urls'. (or 'Refresh' that page if you had left it open in a tab of its own)

You should no longer see the option to 'Run the clean URL test'.

Put a check-mark in the box for 'Enable clean URLs', and click the button 'Save configuration'.

If on the page that loads you see the expression 'The configuration options have been saved.', then you have successfully enabled clean URLs.

2. SimpleScripts installation into a sub-folder that is already password-protected.

If before you install Drupal 7.7 using SimpleScripts, you create and password protect a sub-folder that you intend to use later for your SimpleScripts Drupal 7.7 installation, the password protection process creates a '.htaccess' file within that sub-folder.

That .htaccess file contains only a few lines similar to...

AuthType Basic
AuthName "name of the protected directory"
AuthUserFile "/home1/samplesite/.htpasswds/public_html/sample-sub-folder/passwd"
require valid-user

Then, upon installing Drupal 7.7 using SimpleScripts, that original small .htaccess file remains unchanged, and either a .htaccess.txt file is added to the Drupal 7 root folder; or at times, no .htaccess.txt file is added into the root folder.

If you try to enable 'Clean URLs', you will be unsuccessful.

Click the button 'Configuration' at your page top in the administration menu toolbar (This toolbar is present because the Core module 'Toolbar' is enabled by default), and on the page that loads, look under the heading 'Search and metadata' and click the link 'Clean URLs'.

If you click the button 'Run the clean URL test', it will return the exact same page-- no matter how many times you try.

To fix this problem, you need the proper .htaccess file in your Drupal 7.7 root folder.

  • If the .htaccess.txt file is present...
    1. Delete the small original .htaccess file (which will leave your site no longer password protected for the time being).
    2. Rename the .htaccess.txt file to .htaccess.
  • If the file .htaccess.txt is not present, you need the .htaccess file with 137 lines of code that you would normally have if you were to have installed Drupal 7.7 manually using FTP (or if you had extracted the D7 Core tar.gz [or zip] file via your web-host Control-Panel File-Manager).
    1. Go to
    2. Download the Version 7.7 'tar.gz' or 'zip' file. (Either one will work.)
    3. Extract that Drupal 7.7 Core file onto your computer system.
    4. Upload the newly acquired .htaccess file.

      This should overwrite the original .htaccess file, but will render your site no longer password protected for the time being.

If you have any problems replacing or deleting the .htaccess file, it is likely because that file has a pemission level of 0644. In that case, the file's permission needs to be changed to 0777 before it can be overwritten or deleted. (Other numbers might work such as 0755, but 0777 has always worked for me) You can change any file's (or folder's) permission level number by going to your web-host's Control Panel and using the 'File Manager' (or similar). Find the file. Highlight the file name, and then click the button 'Change Permissions' (or similar).

2011.08.09 - Note from Eric at BlueHost support: "... Also, just as a side note, using 777 permissions is never a good idea. Apache (our web server) actually blocks access to scripts with 777 permissions. 755 should be okay for anything you need to do." -Eric

The permission level for the new .htaccess file you renamed from .htaccess.txt-- or for the .htaccess file that you uploaded-- should already be 0644; but you might want to check that it is 0644.

Enable Clean URLs.

Note: If your site is in 'Maintenance mode', take it out of 'Maintenance mode'.

Return to 'Configuration' >> 'Search and metadata': 'Clean Urls'. (or 'Refresh' that page if you had left it open in a tab of its own)

You should no longer see the option to 'Run the clean URL test'.

Put a check-mark in the box for 'Enable clean URLs', and click the button 'Save configuration'.

If on the page that loads you see the expression 'The configuration options have been saved.', then you have successfully enabled clean URLs.

If you want to password protect your Drupal 7.7 installation again, you can do it via your web-host's control panel as you had originally done. That process will add the few lines from your original .htaccess file to the bottom of the newer .htaccess file starting below the final line...


Hopefully this problem will be resolved in the future thus rendering the instructions above null-and-void ...hopefully.

"All the best; intended."
- Chris

Drupal 8 is great.

Re: Drupal 9,000
Three-minute Video on the problem
of technology out-pacing users.

gabocharrua’s picture

Thanks !!! you just made a small comment that was a big help!!!....... you can't enable the clear url while you are in maintenance mode! MAN!!! 3 hours looking for the solution!! thanks for talking the time to do it.

Christopher James Francis Rodgers’s picture


By default Simple Scripts will not enable clean URL's for Drupal or the .htaccess file. This is done for a couple of reasons including numerous requests from hosts and users that had issues with the default settings and the .htaccess file. In almost every case the default package from the script developers is left in tact however in some cases such as drupal if a reasonable change which is easily reversible and does not affect overall functionality can be done we will try to be accommodating. In this situation renaming the .htaccess file which is left in tact will resolve the issue as the link indicated. Unfortunately we cannot account for password protection using a .htaccess file which would be an issue and require a bit of modification regardless of how Drupal is installed.

As a general rule custom .htaccess files in the web root directory can be problematic so we generally discourage running any Simple Scripts processes while the web root custom .htaccess file is still functional. Renaming this file prior to using Simple Scripts is typically a good idea. This is only applicable to the web root/public_html .htaccess file. As the .htaccess.txt file is named to avoid conflict with a default .htaccess files it should always be included in a standard installation. In the event that there is a file conflict including with the .htaccess.txt file Simple Scripts is designed to identify this and notify users prior to beginning the install.

We do appreciate the notification regarding this issue and are currently looking in to some ways to provide user specific feedback for situations such as this in the install and other processes. Our goal is to continue to simplify the process for our less technical users who only want the basics while still providing advanced options and feedback when needed for more advanced users such as yourself. Additional functionality to address such issues will likely be included in the next major update to Simple Scripts which will be coming soon. Thanks again for the information and for using Simple Scripts.


"All the best; intended."
- Chris

Drupal 8 is great.

Re: Drupal 9,000
Three-minute Video on the problem
of technology out-pacing users.

ds2011’s picture

Hi, I was using this tutorial to setup clean URL's on Green Geeks, but for some reason it's not working. I don't have root access, so the only thing I can do is modify the .htaccess file. Am I missing something?

Christopher James Francis Rodgers’s picture

That is the essence of the Comment above...
Drupal 7 - 'Clean URLs' problems with SimpleScripts

If you have access to .htaccess, that is all you need.

You do not need access to a higher level on your webhost.

Even if your Drupal installation is at the top-level of your hosted site,
the .htaccess file will be within you website's "public_html" folder
(if not within a sub-folder of "public_html"
named according to your site as I am accustomed to seeing)
though at times your website files might be in the "www" folder;
although in my case, going into the "www" folder
actually takes me into the "public_html" folder
as it turns out.

Depending on the problematic present status of your ".htaccess" file,
for example the problem might be that...

  • It is still named ".htaccess.txt"
  • It is named ".htaccess" but, it is essentially a blank file

The problems that I replicated with ease
could all be solved with the simple solution of
downloading to my computer a fresh copy of Drupal Core 7.7,
extracting it, and uploading the .htaccess file to the Drupal-root.

(the drupal root is the folder that houses the Drupal folders,
"includes", "misc", modules", profiles", etc.)

It is important that if you had a .htaccess file already on your site
(as opposed to a .htaccess.txt file on your site)
... it is important that the old .htacces file is destroyed for sure
and is replaced for sure by the new one...
... and that the new one is in fact named .htaccess.

An FTP client will give you its true name.

If, on the other hand, you try to establish the true name of the file
on your computer and you are using Windows, the default computer settings
will hide th file's true extensin name, and likely will hide the .htaccess file itself.

And if using Windows, you open the .htaccess file with, for example,
NotePad or WordPad, and you save it with Notepad or Wordpad,
it could be being saved as .htaccess.txt without your knowing it
if your files on your computer are Not ALWAYS SHOWING their file extensions
(the "period" and last 3 or 4 characters of its true file name).

On Windows XP, for example, (and it is fairly similar on Vista And Seven)
to set your computer to always show
the file extensions, you MUST remove the check box from
"hide extensions for known file types".

Again, on Winwows XP (and similarly located on Vista and Windows Seven
which I have done on each , though I do not remember the exact/ precise details
except to say that you can find it with relative ease)
open an Explorer window on your computer
(Not to be confused with the "Internet Explorer browser"<< not that)
and click in the top main menu the item "Tools"
then in the drop-down menu click "Folder Options..."
and in the "folder options" window, click the top tab "View"
and scroll down the center list until you see
"hide extensions for known file types"
and REMOVE the check-mark from that box.

REMOVE the check-mark from the box
"Hide protected operating system files (recommended)"
since that might be hiding the file .htaccess from you as well.

And click the button "OK" at the bottom of that "folder options" window.

Okay, that's problem one solved. Now problem two..

And if you ever try to name a file as .htaccess from whatever it is named
using the normal Windows XP file and folder viewer window
known as a Windows Explorer window, it will not allow you
and will say something to the effect that "you have to use a name"
meaning that since you have nothing in-front of the "period",
it has no name.

However, if you want to create a file named .htaccess
or rename a preexisting file to .htaccess,
you can in fact use either NotePad or WordPad.

Open the file you want to re-name .htaccess with either, WordPad or NotePad
and then Click "File" > "SAVE AS" the file,
and use double quotes on either side of its name
before clicking "Save". Precisely and exactly like this....


Saving a file that you specify for its name
with the double-quotes creates a file named .htaccess.

Similarly if you are creating a new file that you want
to have named .htaccess
(as opposed to trying to rename a file to .htaccess...)
... just make sure you use double-quotes on its front-end and back-end
before you save it and it will turn out named .htaccess

And if you are using your CPanel to try to upload the .htaccess file
(instead of a FTP program... FileZilla is a free FTP program)
then you might not be replacing the old .htaccess file when you think that you are.

The .htaccess file you need to see online should be 5410 bytes; or so.

Good luck, my friend(s).


Update 2012.03.10 - Drupal 7.12

If your site is in 'Maintenance mode', take it out of 'Maintenance mode'.

After I renamed ".htaccess.txt" to ".htaccess", the Clean URL test failed for me -- until I took the site out of 'Maintenance mode', and revisited/refreshed the 'Clean URLs' page; at which time the site then began displaying the check-box to enable clean URLs.

"All the best; intended."
- Chris

Drupal 8 is great.

Re: Drupal 9,000
Three-minute Video on the problem
of technology out-pacing users.

Gloria Rom’s picture

In step 2 of the section "Server configuration for Clean URLs on a dedicated server, with httpd.conf", the find command should be
find /etc -name "httpd*"
The doublequotes prevent your shell from matching the pattern against the contents of your working directory before it calls the find command. For example, if there were a file called "httpd.txt" in your working directory and you didn't use the doublequotes, you would be running
find /etc -name httpd.txt
without realizing it.

EvivE’s picture

IF your site is broke from clean urls in drupal 7 provided you are logged in as admin

xtiansimon’s picture

Another common configuration for a developing Drupal projects on one domain is a sub-domain multi-site.
The base directory for my site is:
and Drupal is installed in a sub-directory:
with the multi-sites installed in the sites folder,

Adding this example would help to confirm there are not conflicts between the rewrite rules for sub-domains and clean url rules and multi-site rules. Here are my working settings on a shared host with PHP running as CGI:

   RewriteBase /drupal6
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_URI} !=/favicon.ico
   RewriteCond %{REQUEST_URI} ^(.*)$
   RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
tomassiro’s picture

Yeah for hostgator this worked when using the ip instead of the domain name, change the following in your htaccess to:

# If your site is running in a VirtualDocumentRoot at,
# uncomment the following line:
RewriteBase /~yourhostgatorusername

make sure you put the ~ in there

JPMem’s picture

We are still having trouble switching our Drupal6 clients over to hostgator.

We have set it up on server

If you go to you get the home page, which is good, but when you click on a link, such as the first one, "Worship Services" then "Overview" the relative pathing is messed up by the /~temple/ (username folder)
(see above) If you add a ?q= it will fix that page, but we need to turn it over to them to copy the hundreds of pages & many many links with fixed paths.

Everything would work fine if we could setup the temp site and get copy all entered with the paths as they will work when the domain is pointed, but they will need a couple weeks / months to get everything moved over and tested --- then when the domain is pointed, the links would need to be changed.

We have tried the .htaccess RewriteBase /~temple and all the suggestions on here. Seems that most people backup their site and move it over and make it live, but what about when the site needs to be in temp / testing mode while all the copy is re-org'd? THANKS :)

ilikevanilla’s picture

added the following to htaccess

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

twelch’s picture

This is probably from the 'everyone but me knows that' file, but:

Subject line says it all, after moving a site up to a server and messing with .htaccess and base urls and all the other good advice given here, it occurred to me that path and pathauto also rewrite urls. I turned them off, clean url test passed, turned 'em back on and bob's your uncle.

spigot’s picture

The 'test' that Drupal 6 does seems to be doing nothing more than looking at the current URL, if it is of the form '/?q=' you are told that your server cannot use Clean URLs; I made the relevant changes to my httpd.conf and refreshed the page '' to see if Clean URLs could be enabled on my system, but nothing seemed to work.

I then tried viewing the page as if Clean URLS were enabled, '', and found that the status had changed, Clean URLS could be enabled, even though NO SETTINGS had been changed!

So the 'mystery' of setting up Clean URLs is really just about setting up a correct rewrite rule for Apache and the 'test' to see if your server is able to use Clean URLS seems to be doing nothing more than just checking the current URL!

Try it, view your site here, and I get the report that clean URLS cannot be enabled (you need to unenable it first).
View it here and Clean URLS can be enabled (as long as you have the correct rewrite settings).


masinij’s picture

Why does the page not contain a check box to disable clean-urls???

The only thing displayed on this page is "Run the clean URL test".

How can I disable clean urls on the website? - The site is running on a shared server, and the host settings mean i can not modify .htaccess or apache configs. I do have access to phpmyadmin.

eastface’s picture

I think it's probably because you are not using a clean URL, and that is enough for the test to think that they are already turned off. Try this instead:


jsantos77’s picture

Had same problem and did what you suggested and it worked great. - Thanks.

Sam Moore’s picture

Thanks for this one.
I did have to enable the rewrite module (I'm on a new VPS for my current project) but once I did that Clean URLs still were mysteriously not working.
Your suggestion fixed it.

ankitpatni’s picture


After searching lots of sites i came to know about Clean URLS solution on windows 7 (IIS7). We need to add web.config file under Drupal folder where we have files and folders like

  • Includes
  • misc
  • modules.... etc

add web.config file on this root and write the given code to fix clean URLs

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                    <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
gnuskool’s picture

Rename your htaccess file to a text file and use the one that was installed with drupal ie rename it to .htaccess

Works on Drupal 7.9 on

shaiss’s picture

I couldn't enable Clean URLS. Simple fix, disable Maintenance mode, enable clean URLs, re enable Maintenance mode.

p_rooster’s picture

Just point your browser to the clean url and enable it from there: http://[your_drupal_server]/admin/config/search/clean-urls then enable and save. Also to clean up the urls even more, disable the Overlay module. Worked for me.

Sneakyvv’s picture

I don't know why this isn't included in the default drupal rewrite rule but e.g. does not work, not even if you use The $_GET['q'] param will be just module_menu_hook/company. The rest is being cut off. This is because the apache rewrite rule is incorrect. It should be

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

Note the B at the last line => see

This way the $_GET['q'] is correct.

jamix’s picture

This is no longer a problem in Drupal 7. Also note that the B flag is supported since Apache 2.2.7.

Perf Squad - Drupal performance tuning and optimization
Grab our free whitepaper on the 9 steps to make your Drupal site blazing fast!

jwillers’s picture

Drupal 7 likes to access itself, so if you have a server behind a firewall and are working on a site that isn't directly accessible by the public yet, you will have to edit the hosts file in order for Drupal to recognize that Clean URL's are working. This will also fix up some Status Report problems, too.

Here is an example I was struggling with: I have working on my server with a DNS working, and a www folder with a site in it. Updating to Drupal, we create a /drupal folder, load up Drupal 7 and get working with in our vhost.conf file. After getting everything set correctly, it still doesn't work. We must update /etc/hosts so that the server can see (so that we don't have to make it live to the world).

I hope this helps someone struggling with this in the future.

diskojerk’s picture

So just in case anyone else runs into this issue, I'm posting my experience here.

I built a site in a subdirectory on my server in my sandbox directory ( I had clean urls enabled along with pathauto etc. I transferred my files over into the permanent directory ( So now I have both sites running in different directories on the same server. I disabled clean URLS and deleted all the aliases which got the one in its permanent home working properly and allowed me to get into the admin section (before disabling clean URLS and the aliases, only the front page would show up).

So now everything is running great, BUT, I can't get clean URLS to work. I only have the option to run a test and no matter how I configure the .htaccess and config file, the test fails. It shouldn't though. It worked on the sandbox directory, no reason it shouldn't work now. But no. Put in a random string into .htaccess to see if it was being read. Big error, so yes. No reason to go crazy configuring Apache or bothering my host.

One thing. After I got everything working, I put the site in maintenance mode. So I figured what the heck, I'll take the site out of maintenance mode and see if that makes any difference.

BINGO! The test clean URLS button was gone and the lovely enable clean URLS check box was back where it was supposed to be. So, since i didn't see anything about this anywhere I thought I would share.

V 7.12

Lenn-art’s picture

Drupal 6 worked for years on my server. However Drupal 7 returns the error 'The clean URL test failed. ' Strange, because Drupal 6 works. After a bit of searching, i uncomment the default line in .htaccess and added the variant:

# RewriteRule ^ index.php [L]
  RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

After this, the error disapperead.

So, check carefully if this line with the RewriteRule is correct.

There are 10 people who can count binary
They who can and they who don't

spike22’s picture

If you're using https with drupal (doesn't matter wich version) don't forget to place 'AllowOverride All' to your ssl.conf!!!

  1. Go to "yoursite/?q=admin/config/search/clean-urls" , you can notice that you can't enable clean_urls
  2. insert the following code to your ssl.conf file (near to httpd.conf)
  3. <Directory /var/www/yourfolder>
    RewriteEngine on
    AllowOverride All
    Options FollowSymlinks
  4. Go back to the previous url, you'll see no change, but if you delete the "?q=" from the url and press ENTER, you'll notice, that the checkbox appeared. Check+Save! After that clear all your caches, and voila!

see more here

leonkarthi’s picture

Hi Guys, VEry Much thanks for you. Was searcing for my clean-url solution for multisite scenario which was not working well in my server. found my solution from the above mentioned code which is to be configured ahead of the already existing rule-conditions. (can find my version of the solution to solve multisite clean url issue in )


MikePsmith’s picture

What worked for me:

mod_rewrite is enabled by default on the Z-Wamp httpd.conf (located in ZWamp/vdrive/.sys/apache2/conf/):
LoadModule rewrite_module modules/

Do NOT add the following:
AddModule mod_rewrite.c
In my case, it prevented Z-Wamp from starting the Apache service.

Add the following section in httpd.conf:

<Directory /web/your-website-folder>
   RewriteEngine on
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Please note: "/" is set to ZWamp/vdrive/ by default.
Also, do NOT include the following if you have set the Directory name as described above:
RewriteBase /
fibonac’s picture

drupal 7 site run the clean URL test

"the clean url test failed clean urls cannot be enabled if you are directed to this page or to a page not found (404) error after testing for clean urls"

error messsage
not working clean url

help me?

rwilson0429’s picture

The default Drupal 7 .htaccess file comes with the necessary directives to allow clean urls to work. So, in most cases, you shouldn't have to modify the .htaacces file that came with your Drupal 7 distribution to get clean urls to work properly. However, you may need to tell the Apache web server to allow the .htaaccess file in your Drupal 7 root folder to override Apache's default directives.

On an Apache web server, putting the following directive in your httpd.conf should work:

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all


Sam Moore’s picture

Just spent a couple hours on this.
I have a D7 install on Amazon AWS (EC2 micro-instance).
I installed the LAMP stack with apt-get install lamp
What I found is that there are separate files created in /etc/apache2 - for example in the site-available directory, there's a default file that holds virtual host directives, unless you put them somewhere else.
Any of these virtual host directives can contain AllowOverride None, especially if you're setting up your virtual hosts with some sort of control panel (I use webmin).
So make sure you've looked in these config files and changed the directive for your Drupal document root to AllowOverride All .

mts204’s picture

I have many sites work with clean urls, except one... for this, change the value in database, on table "variable" set clean_url value: s:1:"1"; and work!


jasv’s picture

this rule in the Drupal ".htaccess" file worked for me, line 105:
"RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]" (without "...")
the "/" before "index.php?..." was the solution!
Works on site "Hostinger" free hosting:

xax’s picture

On all the sites I built, all D7, on different servers and hosting companies, I went through all the htaccess and settings.php steps, but every time I got to the same page where it said, 'clean urls can't be enabled' etc.

This until I found that if I pasted "/admin/config/search/clean-urls" directly after my url (so you get "http://yourdomain.tld/admin/config/search/clean-urls" in the address bar, RATHER then clicking through the menu (i.e. following the route "Administer > Configuration > Search and metadata > Clean URLs"), all worked straight away. (That is with the .htacces amended as described above of course..)

Hope this will help someone someday..

pelletierb8’s picture

After many hours of messing with clean urls on a multisite setup on bluehost I finally got it to work. I thought I would post my .htaccess file settings to hopefully help someone else. My site was setup with the main page in /Drupal and symlinks for the other sites like /Drupal1 and /Drupal2 .

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} ^/Drupal
RewriteRule ^ Drupal/index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} ^/Drupal1
RewriteRule ^Drupal1/index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} ^/Drupal2
RewriteRule ^ Drupal2/index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} ^/Drupal3
RewriteRule ^ Drupal3/index.php [L]

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

alanseto’s picture


I currently have problems with uploading images and using clean urls.

When I upload an image to an article page and then I click refresh to view the page, the image doesn't appear. I check for the image url and an example url would be:


but the image would appear if I modify the url on the address bar to:


I have tried:

  • turning on and off clean urls (sometimes the images appear, but then they disappears again)
  • modifying rewrite rules in the the .htaccess file
  • folder permissions

This happened when I uploaded my site to an apache server and the url changes, but doing it locally on my computer, the url doesn't change.

alozie’s picture

I've setup a few servers over the past couple years and yet have found myself returning to this page in exasperation more than once. The servers are generally use subfolder multi-sites, e.g.,, etc. Hopefully the D7 example below will help future me jog his/my memory along with anyone else who happens to view this comment:

  1. I make sure that AllowOverrides is enabled on the docroot or the Drupal core directory in the Apache configuration. Otherwise, none of the rest really matters. If you do edit httpd.conf, be sure to reload or restart Apache. Missing that step's cost me hours of troubleshooting I can never get back.
  2. I then setup the rewrite directives in the shared core's .htaccess file:
    #   RewriteBase /

    # rewrite for
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteCond %{REQUEST_URI} ^/site-1/(.*)$
      RewriteRule ^(.*)$ /site-1/index.php?q=$1 [L,QSA]

    # rewrite for
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteCond %{REQUEST_URI} ^/site-2/(.*)$
      RewriteRule ^(.*)$ /site-2/index.php?q=$1 [L,QSA]

      # RewriteCond %{REQUEST_FILENAME} !-f
      # RewriteCond %{REQUEST_FILENAME} !-d
      # RewriteCond %{REQUEST_URI} !=/favicon.ico
      # RewriteCond %{REQUEST_URI} ^/(.*)$
      # RewriteRule ^ /index.php [L]

    Note: I've tried the setup with and without rewrite base and the base rewrite rule (for "^ /index.php") enabled and not seen a difference. It seems to matter more (enabled) when the site(s) are off the server or virtual host's docroot. Most of the problems I encountered were with overrides not being enabled for .htaccess, or misspelling of site directories.
  3. If you're a Shibboleth user you may need to add the following rewrite condition to each rewrite rule block:
    RewriteCond %{REQUEST_FILENAME} !Shibboleth*
  4. From there I visit the Clean URLs page (e.g., and can finally see the elusive checkbox. Whew!
wwritter’s picture

For the complete novice to Drupal: If you're using GoDaddy as a host and you're having trouble getting clean url's to work like me. Maybe you're not getting the checkbox to turn on Clean URL's when you go to the page to enable them. Before you get up to your neck in mod_rewrites and .htaccess files, be sure to look for a file called "example-web.config" in your directory (folder) where drupal is located. Change the name from "example-web.config" to just "web.config". You'll immediately be able to enable Clean URL's.

PMorris’s picture

In case anyone has the same problem as me being unable to use clean urls when using virtual hosts. To get virtual hosts to use Drupal's htaccess file I had to add "AllowOverride All" to my httpd-vhosts.conf

<VirtualHost *:8888>
DocumentRoot "/mypath"
ServerName mysite.local
<Directory "/mypath">
AllowOverride All
isachpaz’s picture

System: Ubuntu Server 12.04 TLS with plesk installation
Drupal: v7.23

Although, the rewrite module is enabled on apache2, .htaccess file is in place and works properly, I am not able to set the Clean URLs property via drupal web interface.

Please, go to your drupal installation and look for settings.php file. Normally it is located here... /var/www/vhosts/mysite/httpdocs/sites/default/settings.php
Open the file with: vi settings.php and seek for $GLOBALS['conf']['clean_url'].
I bet that the assigned value is $GLOBALS['conf']['clean_url'] = 0.
To overcome the problem with setting Clean URLs, you have to set this value to 1.
$GLOBALS['conf']['clean_url'] = 1.
Finally, save your changes (:wq!)

At least, it worked fine for me!

All the best,


bbochicchio’s picture

The process I followed after much reading, tail-chasing and wisdom-merging was this:

Enabled the rewrite mode using:

sudo a2enmod rewrite

Restarted apache :

sudo service apache2 restart

Opened the apache2.conf file in nano:

sudo nano /etc/apache2/apache2.conf


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

Please note that my drupal7 install is in the www/html folder.
So if yours is in /var/www/drupal7 then use that in the opening tag

Restarted apache :

sudo service apache2 restart

Tested it again using Configuration >> Search and Metadata >> CleanURLs

Got a thumbs up. Clicked the check box. Celebrated!!!

Then I wrote this before I forgot what I did :)

btw.. my setup is a VPS on Digital Ocean using the Ubuntu 14.04 x32 image.
They have great documentation for setting up VPSs. This is my first VPS setup
and it's been pretty painless all things considered.

Not sure if it's OK to do this, but if you decide to give them a try and want to help a brutha out, use this referral
URL to create an account

markus’s picture

Lookout for "Rename Admin Path" module!!!

Clean urls direct to:
/admin/config/search/clean-urls !
But if you don't have the default admin's path, you get this error message!

Then try this:

It works.

varunpdrupal’s picture

To enable clean url in ftp or another server just use this line of code and its work

# RewriteBase / drupal

Change "drupal" from your "file name(folder name)" and uncomment it.

RewriteBase /school.

Now you are done. You got your website clean url enabled

Varun Kr Pandey

yuwenyan’s picture

I am on godaddy shared service, migrate my website from my localhost.

godaddy: IIS/PHP/MySQL, drupal 7x.

1. I changed web.config under my webroot folder, copied exact contents in

-- then i re-run my webpage, clean url selection showed up, but can't be selected (selected the checkbox, saved, but still shows up as nothing selected. and I ran the manual update url, no url cleaned up)

2. then i changed $base_url in settings.php under /sites/default folder as well, still not working.

seems to me, it is some access problem, that this configuration is not written to anywhere, but there is no error information at all, since i am not using dedicated service, i cant change httpd.php file....anyone has any experience or suggestions?


Dave Hansen’s picture

This snippet (from above) worked for me...

I change the following line in the .htaccess:
(exactly how it comes by default in the drupal installation files):

RewriteRule ^ index.php [L]

so it would now be:

RewriteRule ^ /index.php [L]

(note the slash "/" in front of "index.php [L]"

artbody’s picture

i had the problem that mod_rewrite works
if i delete in my Browser the ?q=
gives both the right Page
but i couldn't check CleanUrl nor save it when i check it.

The reason why this happens was found in the settings.php
$GLOBALS['conf']['clean_url'] = 0;
must be changed to
$GLOBALS['conf']['clean_url'] = 1;

than all works fine

pepechambo’s picture

Thanks artbody, this works for me.
I think this happens when, for a reason I don't know, system cannot modify the settings.php file. In my case I also have to modify manually $conf['maintenance_mode'] to TRUE or FALSE for put or take out the site in maintenance mode.

thumbslinger’s picture

Thanks! After a few hours of .htaccess, apache config etc, etc.. simply adding this:
$GLOBALS['conf']['clean_url'] = 1;

to the bottom of my settings.php worked

Ology’s picture

Hey all, More of an FYI but I have found that the test fails and I can not enable clean_urls if the site url is

Whenever we add a user to our server they get a public_html and you can access the site that way. Well I can never get clean_urls to work if I am trying to go to ServerIP\~serveruser\user\login, but ServerIP\~serveruser\?q=user\login works.

Now when I get the domain etc registered and pointing there I can then go to\user\login and enable the clean urls all day long.

So just to save someone else wasting time looking into the .htaccess and mod_rewrite etc... it may just be this and so i figure no big deal.

darshana12’s picture

I have installed drupal 7.34 on my localhost within xampp.

I have tried above mentioned all changes but i m not getting check box to enable clean url.

It is showing Use URLs like instead of
Clean URLs cannot be enabled. If you are directed to this page or to a Page not found (404) error after testing for clean URLs, see the online handbook.
With a button "Run the clean URL test" After clicking on this button it redirecting to the same page with message " The clean url test failed".

Please help me as soon as possible

Vijaya Sankar N’s picture

Daniel90’s picture


my problem is that the clean url test fails although it works if I type in the clean url by myself.
I can also check the box for enabling clean urls at and it says that the configuration is safed. But there are still no clean urls at my website.
Does anybody else have the same problem? Thanks in advance :)!