Forum Moderators: phranque

Message Too Old, No Replies

Activate mod rewrite on apache (windows)

         

cattox

4:16 pm on May 10, 2008 (gmt 0)

10+ Year Member



Hi,

I'm trying to activate mod rewrite on apache 2.2 running on windows xp as a windows service.

I uncommented the "LoadModule rewrite_module modules/mod_rewrite.so" line on the configuration file. I can't find the "AddModule mod_rewrite.c" and if I add it to the file, the server fails to start.
I tryed to override the accessfile name to remove the dot from the name (.htaccess -> htaccess) thrue "AccessFileName htaccess".
I configured the Directory options with:


<Directory />
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

even with qualified path just to be shure:


<Directory "C:/Programas/Apache Software Foundation/Apache2.2/htdocs">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

My test is simple, but it just won't work. Yhis is my
.htaccess:


rewriteEngine on
rewriteRule ^/test\.html$ /works.html

I have the works.html on the root folder. When I hit the test.html on the browser I get the error:

[Sat May 10 16:01:28 2008] [error] [client 127.0.0.1] File does not exist: C:/Programas/Apache Software Foundation/Apache2.2/htdocs/test.html

Does anyone have a hint for me? I'm running out of options..

thanks in advance

jdMorgan

6:15 pm on May 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you actually using MultiViews (content-negotiation)?

If not, don't enable it, as it can interfere with mod_rewrite.

Two errors:

1) In order to use mod_rewrite, you must enable the FollowSymLinks or SymLinksIfOwnerMatch option, as specified in the mod_rewrite documentation. I'd suggest changing your Options directive to:


Options Indexes FollowSymLinks

2) In a per-directory (.htaccess) context, the path to the current directory is stripped from the URL-path "seen" by RewriteRule; In other words, the RewriteRule URL-path is "localized" to that particular .htaccess file's directory. In this case, it means that the leading slash will not be present on the URL-path, so the pattern in your rule will never match. Try:

RewriteRule [b]^t[/b]est\.html$ /works.html [L]

Jim

cattox

8:58 pm on May 14, 2008 (gmt 0)

10+ Year Member



It works! You're the man.

Thanks :)