XAMPP in Windows: Enabling mod_rewrite

Below I will quickly and easily show you how to enable Apache's mod_rewrite in XAMPP Windows. If you are unclear on what mod_rewrite is, it basically takes a long query string url and shortens it to be SEO and user friendly. Now if you are also a CakePHP user, having mod_rewrite enabled is the best course of action. But it seems that mod_rewrite is not enabled with the initial install of XAMPP. Do not worry, it's extremely easy to enable the module, and here's how it's done.

I'm assuming you have installed the xampp directory into the root or C:/ drive. The first thing to do is to open the configuration file located at C:/xampp/apache/conf/httpd.conf. Locate the text below and remove the # from the beginning of it (# acts as a comment and negates the module from loading).

#LoadModule rewrite_module modules/mod_rewrite.so

The final step is to find all instances of AllowOverride None and replace them with AllowOverride All. Now to get mod_rewrite working, you will need to restart your Apache server. You can simply do this by clicking "Stop/Start" next to the Apache module of your XAMPP Control Panel.

6 Comments