Welcome to WebmasterWorld Guest from

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


I am trying to convert the following:




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]

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]

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