Apache mod_rewrite on Windows

3 Responses June 13th, 2008 | Ekerete.

I use Windows XP as my development platform and this is more of a note from me to me so I don’t have to Google for it next time.

I also use WampServer for Apache, MySQL and PHP and while I’ve only tested on that stack, I believe it to be generic enough.

  • Open the Apache httpd.conf file and uncomment the line ‘LoadModule rewrite_module modules/mod_rewrite.so’ (remove the pound ‘#’ sign from in front of the line).
  • If the lines ‘ClearModuleList’ and ‘AddModule mod_rewrite.c’ are in your httpd.conf file, make sure they are not commented out.
  • Find the section with Document Root: DocumentRoot “C:/path/to/my/root”
  • Modify the option for AllowOverride to look like this:
    <Directory />
        Options Indexes FollowSymLinks
        AllowOverride All
    </Directory>
  • Restart Apache

Apache mod-rewrite should now be working.

3 Responses to “Apache mod_rewrite on Windows”

  1. V Says:

    But it’s not :(

  2. Wick Says:

    @V: probably because you have a more specific directive farther down your httpd.conf.

    I prefer it this way – and I believe Apache also suggests this – set the default to be very restrictive & then open up permissions for specific areas of the server:

    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

    Options FollowSymLinks IncludesNoExec
    AllowOverride All
    Order allow,deny
    Allow from all

  3. Wick Says:

    oops, the codes got stripped by wordpress. Put these around the code blocks above.

    <Directory />

    </Directory>

    <Directory “C:/wherever_you_keep_your_public_web_files”>

    </Directory>

Leave a Reply