How to enable clean URLs in Drupal 6.19

Drupal could be considered as one of the big three open-source Content Management Systems (CMSs), in addition to WordPress and Joomla. Its installation is simple. First, it requires a new blank database in MySQL with some proper privileges. Then, unzip the drupal downloaded file into a web root directory of a web server. In case of Apache HTTP server, the web root directory is the htdocs directory. Finally, make a copy of default.settings.php in the $Drupal_Home/sites/default directory and rename it to settings.php. Nothing much to do rather than some mouse clicks and a few typings.

Although the installation is not difficult, its configuration needs some patience and knowledge. One desired configuration is to enable clean URLs. There are various approaches posted on the Internet. Some of them work for some people, and some of them don’t.

So, in this post, I’d like to share what is worked for me. My system is:

  • Windows Vista (64-bit)
  • Apache HTTP Server (2.2.16 win32 x86 with ssl, msi installer)
  • PHP (5.3.3 win32 VC 9 x86)
  • MySQL (5.1.49, win32, noinstall version)
  • Drupal (6.19)

To install Drupal, I unzip (and rename) Drupal into $APACHE_HOME/htdocs directory, resulting in $Apache_Home/htdocs/drupal.

To enable clean URL,

1) Edit .htaccess in $PHP_HOME

Change the following line from:

#RewriteBase   /

to:

RewriteBase    /drupal

2) Edit httpd.conf in $APACHE_HOME/conf

Change the following line from:

#LoadModule rewrite_module modules/mod_rewrite.so

to:

LoadModule rewrite_module modules/mod_rewrite.so

, and then change this line from:

AllowOverride None

to:

AllowOverride All

Note: there are more than one AllowOverride None in httpd.conf file. The correct one is under the paragraph with .htaccess in it.

3) After saving those modifications above, restart MySQL and HTTP Server, open a browser, and point the browser to http://localhost/drupal. Next, click on “Administer” –> “Clean URLs”. Now, The “Enabled” bullet list should be active.

Hope this help save you guys’ time.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment