homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Mod Rewrite

5+ Year Member

Msg#: 3168303 posted 4:14 am on Nov 26, 2006 (gmt 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)



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

Msg#: 3168303 posted 2:03 pm on Nov 26, 2006 (gmt 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.



5+ Year Member

Msg#: 3168303 posted 6:29 pm on Nov 26, 2006 (gmt 0)

Thank you Jim.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved