Forum Moderators: phranque

Message Too Old, No Replies

How do i make mod_rewrite work without compiling apache2?

rules not working!

         

sandhya

10:30 am on Jul 21, 2005 (gmt 0)

10+ Year Member



My web hosting has Apache/2.0.46 (Red Hat) Server with php. I have tried the simple rewrite rule in .htaccess file

RewriteEngine on
RewriteRule ^alice.html$ bob.html

with a simple file alice.html.

In my conf file, the loadmodule of mod_rewrite is enabled. Can you please tell me why I get the error 404 Not Found.

The requested URL /test/bob.html was not found on this server.

Is there a way i can make mod_rewrite to work without compiling apache, disturbing the current server?

chrisjoha

11:00 am on Jul 21, 2005 (gmt 0)

10+ Year Member



Well, it would seem that your rewriting is working just as expected. You ar rewriting every reuest for 'alice.html' to go to 'bob.html'. The server does that, and then throws a 404 when it cannot find the 'bob.html' file. Maybe you confused the direction of it and expected 'bob.html' to become 'alice.html'?

sandhya

12:32 pm on Jul 21, 2005 (gmt 0)

10+ Year Member



Thanks chrisjoha,
As you said i was confused! That was a test i conducted to make sure my mod_rewrite works or not.

We use oscommerce for our site, and adding this in .htaccess file really soved my problem :)

"
AcceptPathInfo on

RewriteEngine On
RewriteRule catalog/([0-9]+)/([a-z][0-9]+)/ /catalog/index.php?cPath=$1&osCsid=$2

RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*) index.php
"

I hope this will help all oscommerce users using apache 2 with seo friendly urls turned on.

Thanks again!