Apache mod_rewrite on Windows

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.

No related posts.

This entry was posted in PHP. Bookmark the permalink.

5 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>

  4. jlove says:

    still 500 internal server error (even after following your comments). cant count how many tutorials ive found that never have the working solution for apache on winxp.

  5. Susan says:

    No, it is not working on my server. How can I fix it?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>