Topic: Querystring tacked on after friendly URL ( Topic Closed)
|

|
| Author |
|
ColoMtns Newbie

Joined: 18 September 2009
Online Status: Offline Posts: 3
|
| Posted: 18 September 2009 at 5:30pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 3
|
| Posted: 18 September 2009 at 6:26pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 3
|
| Posted: 18 September 2009 at 7:21pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 1542
|
| Posted: 21 September 2009 at 4:27am | IP Logged
|
|
|
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 |
|
| |
|
|
Sorry, you can NOT post a reply.
This topic is closed.
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You can vote in polls in this forum
|