This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Querystring tacked on after friendly URL (Topic Closed Topic Closed)
Author
Message |
ColoMtns
Newbie


Joined: 18 September 2009
Posts: 3
Posted: 18 September 2009 at 5:30pm  

Hello,
I am using ver. 3 Lite. I am using links with the
following style url:
http://www.domainname.com/theme/brand/category/

and rewriting it to:
http://www.domainname.com/products.aspx?
rw=/brand/category/

This is working well with the following rule:
RewriteRule ^/theme/(.+) /products.aspx?rw=$1 [I,L]

but now I realize that when someone tacks on a
querystring to the end (such as Google adwords) it
doesn't work. So, when they are done, the url looks
like:
http://www.domainname.com/theme/brand/category/?
google=garbage

I need to rewrite that to:
http://www.domainname.com/products.aspx?
rw=/brand/category/&google=garbage

Basically, just replacing the question mark with an
ampersand.

Any help would be greatly appreciated.
Back to Top
 
ColoMtns
Newbie


Joined: 18 September 2009
Posts: 3
Posted: 18 September 2009 at 6:26pm  

Oh, and I need a RewriteCond in there to ONLY replace the
question mark if the url has "/theme/" in it.

Thanks again.
Back to Top
 
ColoMtns
Newbie


Joined: 18 September 2009
Posts: 3
Posted: 18 September 2009 at 7:21pm  

OK, this appears to be working. The last line in the code
is the only one I had before.

# first replace any question marks with ampersands (to
catch tracking querystrings)
RewriteCond URL ^/theme/.*
RewriteRule ^(.*)\?(.*)$ $1&$2
# then rewrite the url
RewriteRule ^/theme/(.+) /products.aspx?rw=$1 [I,L]
Back to Top
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 21 September 2009 at 4:27am  

Hello,
For ISAPI_Rewrite 3 please try the following:
Code:
RewriteRule ^/theme(.*)$ /products.aspx?rw=$1 [NC,L,QSA]


__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top Visit Vyacheslav's Homepage
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version