Welcome to WebmasterWorld Guest from 54.144.112.127

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

mod_rewrite querystring param

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

Junior Member

10+ Year Member

joined:Jan 13, 2004
posts:74
votes: 0


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)

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 0


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)

Junior Member

10+ Year Member

joined:Jan 13, 2004
posts:74
votes: 0


Will give it a try. Thanks Jim.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members