mod_rewrite not reading rewrite rule on windows

Discussion in 'Apache' started by hamburger, Jun 13, 2010.

  1. #1
    I have tried to get mod_rewrite read my rewrite rules to no end. My machine is

    Vista + Apache 2.2

    I found "LoadModule rewrite_module modules/mod_rewrite.so" in line 117 of my httpd.conf and removed the '#' sign. Restarted Apache.

    Apache starts up fine.

    I then put the two lines at the end of my httpd.conf file:

    RewriteEngine on
    RewriteRule ^a$ b [L]

    But when I open http://localhost/a ===> 404 Not Found: The requested URL /a was not found on this server.

    Note that it says /a not /b, the rewrite rule isn't read.

    I double checked the mod_write is loaded by running "httpd -M" which shows that mod_rewrite is indeed loaded.

    I tried creating a ".htaccess" file under my web root (htdocs by default) but the rule isn't read either. same 404 error /a not found.

    Please describe to me in baby step, how to get mod_rewrite to work on a windows machine, if you have tried.
     
    hamburger, Jun 13, 2010 IP
  2. hamburger

    hamburger Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Finally!

    The reason is that The rewrite rules must be written INSIDE <Directory "C:/.../Apache/htdocs/"></Directory> scope directory in the httpd.conf. I searched everywhere online but nobody ever mentions about this.

    Why does everybody simply assume a newbie would know that by themselves?
     
    hamburger, Jun 14, 2010 IP