Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod Rewrite

4:14 am on Nov 26, 2006 (gmt 0)

New User

5+ Year Member

joined:Aug 3, 2006
votes: 0

I'm back. Per Jim's earlier suggestion I did some research and tried several things but still no joy.

I'm trying to get from




where the cart id is always 9999999.99999 but the part that reads *SF0L50 keeps changing. Basically, I want to drop the part that reads cart_id=9999999.99999*SF0L50& and keep the rest intact.

I've made several attempts, this being typical:

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteRule ^(.*)cart_id=9999999.99999.......&(.*)$ $1$2 [L,R=301]

Help. (And Thank you)

2:03 pm on Nov 26, 2006 (gmt 0)

Senior Member

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

joined:Mar 31, 2002
votes: 0

The problem is that RewriteRule cannot see query strings -- They are data attached to a URL, but not part of the URL. So query strings must be handled separately. Something like this:

RewriteCond %{QUERY_STRING} ^cart_id=9999999\.99999[^&]+&product=(.+)$
RewriteRule ^store/agora\.cgi$ /store/agora.cgi?product=product=%1 [L]

Several things remain unclear: First, the above code does an internal rewrite, not a redirect. As such, the search engines will keep the old URL in their index, but requests for the old URL will be delivered to the new one internal to the server.

Second, there appears to be a redundant "product=" in your requirements statement above, which I have faithfully reproduced.

Third, the code, as written, will work with only the parameters you specified, and in the order specified.

However, you should be able to work out the necessary changes, if needed, given the documentation I have previously cited.


6:29 pm on Nov 26, 2006 (gmt 0)

New User

5+ Year Member

joined:Aug 3, 2006
votes: 0

Thank you Jim.