Page 1 of 1

mod_rewrite with htaccess

Posted: Mon Oct 17, 2005 1:04 pm
by jwalsh
Hi,

I'm trying mod_rewrite for the first time, and I'm having a problem. The following doesn't do anything, but give me a blank page (no 404 or anything).


.htaccess

Code: Select all

LoadModule rewrite_module /usr/lib/apache/mod_rewrite.so
AddModule mod_rewrite.c

RewriteEngine on
RewriteRule /products/([0-9]+)/([0-9]+) /products.php?cat=$1&product=$2
Also, another one of my programmers has added this line to the top of the htaccess file, could this be conflicting?

Code: Select all

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
Thanks,

Josh

Posted: Mon Oct 17, 2005 6:36 pm
by feyd
mod_rewrite = regex.. Moved.

Posted: Mon Oct 17, 2005 8:04 pm
by Ambush Commander
I don't think you can

Code: Select all

LoadModule rewrite_module /usr/lib/apache/mod_rewrite.so
AddModule mod_rewrite.c
in .htaccess, correct me if I'm wrong.

Posted: Mon Oct 17, 2005 8:24 pm
by feyd
Apache module mod_so wrote:Syntax: LoadModule module filename
Context: server config
Status: Base
Module: mod_so
Apache Core Features wrote:Syntax: AddModule module [module] ...
Context: server config
Status: core
Compatibility: AddModule is only available in Apache 1.2 and later

Posted: Mon Oct 17, 2005 9:39 pm
by jwalsh
I'm still stumped, I can't seem to get mod_rewrite to do anything.

Do I need an apache reboot even with an htaccess file? Been at this for hours, I'd really like to figure this out.

Josh

Posted: Thu Oct 20, 2005 9:44 pm
by jwalsh
Ok,

I've been playing with this a little while, and have confirmed that mod_rewrite is on. Just to test, I've created a simple .htaccess file with the following in it..

Code: Select all

RewriteEngine On
RewriteBase /
RewriteRule ^/test/([0-9]+)$ /test.php?id=$1
This just generates a 404 error, because /test/333 doesn't exist, it's not rewriting. I've been playing with this for around a week, and no luck at all yet.

I heard a rumor that this doesn't work if I'm using the CGI version of PHP, but I don't know if I'm running on that or not.

I appreciate any help.

Josh