How to Enable mod_rewrite For Apache on XAMPP, WAMP

How to enable mod_rewrite for apache in xampp

When you run a website, you might need to setup redirects or rewrite URLs, if you delete old pages, or move some of your pages to a new location. This can be very tedious process if you try to do it from scratch. Luckily, Apache provides a mod_rewrite module that makes it really easy to redirect URLs and setup URL rewrites. Let us look at how to enable mod_rewrite for Apache on XAMPP/WAMP.

Before we begin, it is important to know that .htaccess file is the backbone of mod_rewrite module. It allows you to create URL rewrite rules without accessing server config files.


How to Enable mod_rewrite For Apache on XAMPP, WAMP

Here are the step to enable mod_rewrite for Apache on XAMPP, WAMP


1. Go to the installation folder

Go to the directory of installation for XAMP, WAMP. By default, it is C:\xampp>\apache\conf for XAMPP and C:\wamp\bin\apache\Apache2.2.11\conf for WAMP


2. Open Config file

Open the file httpd.conf using a Text editor. In some systems, the filename is httpsd.conf


3. Find the line containing

#LoadModule rewrite_module modules/


4. Remove (#) from start of the line to enable the module

If you don’t find this line then you can directly add the following line to the file (without # in front of it)

LoadModule rewrite_module modules/

Lines starting with # are considered as comments by Apache web server.


5. Next find AllowOverride None and change it with AllowOverride ALL

Find the string AllowOverride None and replace it with AllowOverride ALL


6. Restart wamp/xampp server

Restart your wamp/xampp server to apply the changes. If you don’t know how to restart XAMPP, you can follow these steps.


7. Test if mod_rewrite is enabled

To test if mod_rewrite is enabled or not simply type phpinfo(); in any file and view it in your browser via URL.

In its the output, scroll down to the Loaded Modules section. You’ll see mod_rewrite

About Sreeram Sreenivasan

Sreeram Sreenivasan is the Founder of Ubiq, a business dashboard & reporting platform for small & medium businesses. Ubiq makes it easy to build business dashboards & reports for your business. Try it for free today!