DrupalDrupal 7 installation and Clean URLs

Drupal 7 installation and Clean URLs

This is a short procedure to install Drupal 7 and enable clean URL’s . This is for setting a drupal site on Ubuntu .

Please note that,

  1. This is a specific type of installation and may not work in many cases – different installations have different requirements
  2. you can use your own custom database, user and folder names

I assume that

  1. You are an administrator on the system / server
  2. You have installed latest stable Apache Web server
  3. You have installed latest stable PHP
  4. You have installed latest stable MySQL database

Install Process

  1. First create a database for drupal in MySQL – call the database “drupal”
  2. Create a user called “drupal_admin” and grant him ALL privileges on the database “drupal” – note down user name and password
  3. Download Drupal 7 and unzip it
  4. Copy Drupal 7 folder to “/var/www”
  5. So path will be  “/var/www/drupal-7.0”
  6. For simplicity and easiness, create a symlink to the drupal-7.0 folder – call it “drupal”
  7. So now drupal -> drupal-7.0
  8. Navigate to drupal/sites/default
  9. Create a folder called “files” inside the “default” folder – please name the folder as “files” as this is drupal standard folder to store all uploaded files
  10. Give write access to the “files” folder to the user “www-data” ( i.e the web server user)
  11. Next copy the file “default.settings.php” to “settings.php” ( both these files must be in the same folder now “drupal/sites/default” )
  12. Give write permissions to “settings.php” for the user “www-data”
  13. Open the "settings.php" and change this line $update_free_access = FALSE; change it to $update_free_access = TRUE;
  14. Locate the $databases = array() line - we have to specify the drupal database here
  15. Change the above line to
$databases['default']['default'] = array(
'prefix'=> '',

16. Open a  web browser and go to the URL http://localhost/drupal/install.php

17. Follow the steps till you finish the installation

18. Your drupal site must be up and running at http://localhost/drupal

19. Remove write permissions to “settings.php”  make it read-only

20. Open the "settings.php" and change this line $update_free_access = TRUE; change it to $update_free_access = FALSE; 
( basically undoing step 13)

Clean URL in drupal 7

21. On your drupal site navigate to Configuration -> Search and Meta data -> Clean URLs -> perform the Clean URL test ( there will be a button )

22. If your site is ready for clean URLs then you will see a check box which says “Enable clean URL” – check it and save and you are done

23. If this is not the case then do the following

24.  you have enable the apache rewrite module (http://drupal.org/node/15365)

25. your apache config file (/etc/apache2/apache2.conf) must have the following  2 lines in it – if not then add them – this tells apache to look for a .htaccess file for settings in the folder “/var/www/drupal”

     <Directory /var/www/drupal>
        AllowOverride All
   AccessFileName .htaccess

26. Make sure you have a “.htaccess” file in the “drupal” folder – that might be hidden

27. Edit the “.htaccess”  file in the “drupal” folder and uncomment the line RewriteBase /drupal ( Remove the # before this line)

28. Restart apache

29. Now again go to Configuration -> Search and Meta data -> Clean URLs -> perform the Clean URL test

30 This will allow clean URLs

Categories: Drupal


  1. claudio rodriguez

    June 3, 2012 7:42 am

    debian had that problem of "clean url" I met with your manual, thanks
  2. sujan

    March 26, 2012 3:33 pm

    what is the directory for wamp in the windows platform AllowOverride All AccessFileName .htaccess please suggest me
    1. March 26, 2012 4:07 pm

      the directory to put the .htaccess file as well as the one you specify in the apache rule ( ) is the directory (or folder) where your drupal installation files are located i think it would be somewhere in C:wampwww and then your drupal installation directory
  3. SGhosh

    February 13, 2012 6:43 am

    Just doesnot seem to work for me!!I still get the same problem -- test failed. :( HELP!
    1. February 13, 2012 1:41 pm

      @SGhosh: Please give additional details on what the problem is and what are you trying to do
  4. January 3, 2012 11:07 am

    It Works For Me!!!
  5. David

    August 23, 2011 11:06 pm

    Thanks for the apache rewrite module tip. I forgot all about that one. Saved me a bit of time.

Post a comment

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