Enabling Mod Rewrite in Xampp

As the final release of WordPress 2.5 fast approaches, I've been having a lot of fun playing around with 2.4-bleeding which has since become WP 2.5 Beta. Since the changes have been coming fast and furious these last few weeks I'm sure glad I use a Subversion client to connect to the WordPress Subversion Repository - it provides for a much simpler and faster method for keeping up to date. Running WordPress in a local environment I prefer to use Xampp, a robust open-source application that will install Apache webserver and MySQL database on your PC with complete access via phpMyAdmin.

Although Xampp is my favourite method of running WordPress locally, there was always a minor little detail that irritated me to no end. In order to use fancy permalinks you of course need mod_rewrite (an Apache module that rewrites permalinks on the fly) enabled otherwise you end up with index.php in all of your permalinks. I hated this. Naturally mod_rewrite is disabled by default. Despite my best efforts in trying to figure out how to enable mod_rewrite in Xampp I failed miserably. I searched the Apache Friends web site with no success. I searched the Xampp Forums, half of which is in German, but came up with nothing. Undaunted I decided to take matters into my own hands and go through the installation files rather meticulously. My labours were rewarded.

For those of you running Xampp 1.6.6a on Windows and unable to figure out how to enable mod_rewrite the fix is simple. Assuming you have installed Xampp in root (which you should) navigate to,

C:\xampp\apache\conf\httpd.conf

Open up httpd.conf in notepad and look for this line.

#LoadModule rewrite_module modules/mod_rewrite.so

Uncomment it so that it reads,

LoadModule rewrite_module modules/mod_rewrite.so

Next, search for AllowOverride None and change it to AllowOverride All. Once you restart Apache you will be able to enable fancy permalinks without the index.php appendage.

About Len Kutchma

Len has been blogging for over 10 years and is a rabid WordPress fan. In addition to blogging here you can find him writing the occasional article and toiling away in the forums at WeblogToolsCollection.com. He also hangs out at the WordPress support forums lending a hand where he can. Be sure to follow @wpcanada on Twitter.

Comments

  1. Ted says:

    Thank you. It worked just as you described.

  2. Len Kutchma says:

    You're welcome Ted.

  3. neekey says:

    Thank you for your tip!

  4. Len Kutchma says:

    You're welcome Neekey.

  5. Joseph says:

    I did as you instructed in the page. But when I restarted the apache, I got a syntax error and is below:

    Syntax error on line 186 of C://xampp/apache/conf/http.conf:
    directive requires additional arguments

    apache could not be started..

    Please help me to fix this.

  6. Joseph says:

    #
    # Options FollowSymLinks
    # AllowOverride None
    # Order deny,allow
    # Deny from all
    #

  7. Len Kutchma says:

    Hi Joseph

    The only lines you need to change are:

    Uncomment this line -->
    #LoadModule rewrite_module modules/mod_rewrite.so

    so that it reads -->
    LoadModule rewrite_module modules/mod_rewrite.so

    Next, search for all instances of -->
    AllowOverride None

    and change it to -->
    AllowOverride All

    If I remember correctly there are 2 or 3 instances of the latter that need to be changed. You may or may not also have to uncomment those lines as well. I have since switched from XAMPP to WAMP so my memory may not be up to snuff.

    If you have any difficulty let me know and I'll reinstall XAMPP and have a look.

  8. heinthu says:

    Thank you!

  9. Len Kutchma says:

    You're most welcome.

  10. Yose says:

    i have same problem like Joseph. . .
    i have an idea,,just upload the file httpd.conf and i'll paste the file to my directory,,

    http://www.e-medan.com

  11. Len Kutchma says:

    Hi Yose,

    I uploaded the file to the WordPress Pastebin. Just click the "download" link to get it.

  12. Yose says:

    thanks very much brother. . .
    nice to visit ur site ;)

  13. Len Kutchma says:

    You're welcome Yose.

  14. $@!ful says:

    Really helpful. Nice post.

  15. rl says:

    Any idea about enabling mod_rewrite to work with mod_userdir user directories????

    The above information doesn't work for user's public_html on linux

    Regards

  16. Len Kutchma says:

    The information is intended for use in a Windows environment. I have absolutely no experience setting this up on a 'nix box. I would suggest visiting the XAMPP forums. They have a section dealing exclusively with Linux.

    http://www.apachefriends.org/f/viewforum.php?f=17

Please Note: WPCanada is a moderated community. Please read the Comment Policy.

HAVE SOMETHING TO SAY?

*