IIS Mod-Rewrite solutions
Overview Documentation Download Purchase FAQ  
IIS Mod-Rewrite - URL rewrite tool for IIS

Clean URLs for Drupal on IIS using .htaccess

23 Dec 2008

This article describes a detailed, step-by-step guide for enabling Clean URLs on Drupal on IIS web server

This solution requires IIS Mod-Rewrite Pro and IIS 6.0 or later, and it is tested with Drupal 5 and 6, PHP 5.2.4, and MySQL 5.0.24.

To enable Clean URLs on Drupal on IIS, follow these steps:

Drupal 6.x

  1. Install PHP following the vendor's instructions.

  2. Install MySQL Server following the vendor's instructions.

  3. Install IIS Mod-Rewrite Pro (download).

  4. If on production environment, activate IIS Mod-Rewrite using a valid license key. If activation is skipped, IIS Mod-Rewrite will work in test mode and you will need to restart IIS every 30 minutes or 1000 requests, if your testing exceeds these limits.

  5. Create an empty MySQL database for Drupal.

  6. Install Drupal according to the vendor's instructions.

  7. During installation you will be prompted to choose an option for "Clean URLs". Choose "Enabled" (default option).

  8. Make sure IIS has sufficient access rights to the file .htaccess located in Drupal root directory. The user group IIS_WPG (if running on IIS 6), or the user group IIS_IUSRS (if running on IIS 7), or the current Application Pool's Identity User must have at least "read" access rights to the ".htaccess" file or to the directory that contains this file.

After, completing all the steps above, your Drupal 6 installation will fully serve Clean URLs, and your website's SEO will be drastically improved.

Drupal 5.x
  1. Install PHP following the vendor's instructions.

  2. Install MySQL Server following the vendor's instructions.

  3. Install IIS Mod-Rewrite Pro (download).

  4. If on production environment, activate IIS Mod-Rewrite using a valid license key. If activation is skipped, IIS Mod-Rewrite will work in test mode and you will need to restart IIS every 30 minutes or 1000 requests, if your testing exceeds these limits.

  5. Create an empty MySQL database for Drupal.

  6. Install Drupal according to the vendor's instructions.

  7. Open with a text editor the file index.php, located in Drupal root directory.

  8. Add the code line

    $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];

    at the beginning of index.php script. After adding this line of code, the beginning of index.php script should look like this:

    <?php
    $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
    ...
    ...

  9. Log on to Drupal as administrator, go to admin panel and open the Administer > Site configuration > Clean URLs page.

  10. In this page will see a paragraph with comments. At the end of this paragraph there is a link saying "Run the clean URL test". By clicking on this link, the "Clean URLs" options will become active. Choose "Enabled", and hit the button "Save configuration".

  11. Make sure IIS has sufficient access rights to the file .htaccess located in Drupal root directory. The user group IIS_WPG (if running on IIS 6), or the user group IIS_IUSRS (if running on IIS 7), or the current Application Pool's Identity User must have at least "read" access rights to the ".htaccess" file or to the directory that contains this file.

After, completing all the steps above, your Drupal 5 installation will fully serve Clean URLs, and your website's SEO will be drastically improved.

 
 
Download and try
IIS Mod-Rewrite
NOW!


IIS rewrite

Download IIS Mod-Rewrite

Purchase IIS Mod-Rewrite