4.Oct.2008

Clean URLs on WampServer

Many content management systems — Wordpress, Drupal, and Silverstripe come to mind — make use of “clean URLs“. This is a feature of the web server which instantly converts people and search engine friendly paths (tool.com/products/screws/) into paths for use by the application (tool.com/index.php?product=4).

On the Apache web server, the rewrite module must be enabled for clean URLs to function properly. This module is usually disabled by default. Fortunately, WampServer provides a graphical interface which makes it simple to modify Apache settings.

Ready to enable rewrite_module? Here’s how:

  1. Start WampServer. An icon should appear in your task bar:
    WampServer icon
  2. Click the icon to open WampServer’s main menu.
  3. Open the ‘Apache‘ submenu and then ‘Apache modules‘.
  4. Scroll down to ‘rewrite_module’ and click to enable it.

That’s all there is to it! A quick tip, but important nonetheless and something I’ve seen a lot of CMS users — myself included — get stuck on. I hope this helps.

4 comments been left:

  1. A Bit Wampy said:

    Ah, I wish it worked here as well! I followed the steps correctly but I get this error message when trying out the clean URL page (admin/settings/clean-urls):

    Bad Request

    Your browser sent a request that this server could not understand.

    What version of Wampserver do you use? Mine is 2.0, and I’m running it under Windows XP.

    I checked the httpd.conf file, and this line is indeed uncommented, but still no dice:

    LoadModule rewrite_module modules/mod_rewrite.so

  2. MikeWhoBikes said:

    I’m also using Wampserver 2.0 on Windows XP. The only thing I can think of off hand is to download the Drupal and replace your .htaccess with a fresh copy. I’d suggest posting on the Drupal.org forums as your best bet.

  3. Baby bob said:

    what you did is you just replace the .htaccess of wampserver 2.0 with that of drupals? and enable mod_rewrite??

  4. MikeWhoBikes said:

    Yes, Drupal comes with an .htaccess file which should be in your main Drupal directory. With mod_rewrite enabled (see the directions above) you should find an option to enable Clean URLs at http://yourwebsite.com/?q=admin/settings

Have something to add? Leave a comment.

Ingredients: , , , etc.

* May contain traces of nuts.