Re: Convert Dynamic URL To Static URL
Posted: Tue Aug 10, 2010 5:05 pm
I am trying to convert my urls from this:
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:
[domain.com...]
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.
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:
[domain.com...]
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.