http://domain.com/cart.cgi?333 to this:
http://domain.com/333 where "333" is the item number of a product.
First I tried mod_rewrite:
RewriteRule ^cart/* cart.cgi?&$1 The page gets redirected and the browser url stays the same, but my cart.cgi script thinks that QUERY_STRING is empty.
So then I thought I'd just get the entire url using PATH_INFO and then parse it, but when I try my script thinks PATH_INFO is empty no matter what. If I turn off mod_rewrite and then type this into my browser:
my script prints the word "test" but not the url, using this code:
[red] $variable = $ENV{'PATH_INFO'};
print $variable;
print "test"; [/red] Any ideas? Thank you very much for your help.
First, the example you gave is:
domain/333
While your rewrite rule implies:
domain/cart/333
Second, you're not capturing anything to $1, use ()'s for that.
Third, * all by itself is not going to produce the outcome you're looking for.
Fourth, you're sending your script data it can't understand:
?&$1
It should be:
?$1 or?something=$1
You'll find no shortage of mod_rewrite examples floating around this and other forums, one of which will do what you want... but I'd recommend actually reading about mod_rewrite and regular expressions so you understand how they work.