Welcome to WebmasterWorld Guest from 54.145.174.178

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

mod_rewrite querystring param

   
10:09 am on Mar 29, 2006 (gmt 0)

10+ Year Member



Hi,

I am trying to convert the following:

www.widgets.com/category/sub/details.asp?prodid=1

to

www.widgets.com/product.php?product_id=1

but I am having trouble replacing the querystring parameter prodid with product_id

I tried the following but it doesn't work:

Options +FollowSymLinks +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^detail.asp\?prodid=$ /product.php?product_id=$1 [QSA]
</IfModule>

Any suggestions?

1:35 pm on Mar 29, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Query strings are not part of a URL. Rather, they are data *attached* to a URL to be passed to the resource *at* that URL.

Therefore, query strings are handled separately in Apache:


RewriteCond %{QUERY_STRING} ^prodid=([^&]+)
RewriteRule ^detail\.asp$ /product.php?product_id=%1 [L]

Jim
2:58 pm on Mar 29, 2006 (gmt 0)

10+ Year Member



Will give it a try. Thanks Jim.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month