Welcome to WebmasterWorld Guest from 54.196.153.46

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Rewrite Rule and affiliate ID problem

     
1:07 pm on Jan 7, 2008 (gmt 0)

New User

5+ Year Member

joined:Jan 7, 2008
posts: 5
votes: 0


I finally had my htaccess file running smoothly (thanks to the existing posts here on WebmasterWorld) - when a new problem emerged.

Using the following type of rule I have managed to run the site using SEO friendly URLS:

RewriteRule ^([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)/$ /index.php?VAR1=$1&VAR2=$2 [L]

So if someone types in www.mysite.com/foo/bar/ all is fine.

However we have just started an affiliate program and I can't seem to access the affiliate ID in a URL such as:

www.mysite.com/foo/bar/?AFF=ID

I'm sure that I need to make an allowance for this somewhere - though I just can't figure what or where. Can someone please shed some light on this?

Thanks for your assistance,
Andrew

12:03 am on Jan 8, 2008 (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


We'll be needing some examples of the URLs and their corresponding script paths to proceed. ALso, some clarification of "cannot access the aff ID" would be helpful.

What modified rules have you tried with these URLs and what was the result? How did the results differ from your expectations?

Jim

2:19 am on Jan 8, 2008 (gmt 0)

New User

5+ Year Member

joined:Jan 7, 2008
posts: 5
votes: 0


Thanks - I'll dig up some of the testing that I previously tried.

In terms of "cannot access the Affiliate ID" - what I really meant was that if I load the page 'www.mysite.com/foo/bar/?AFF=ID' - the $AFF variable is empty (has no value at all).

2:41 am on Jan 8, 2008 (gmt 0)

Senior Member

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

joined:Sept 29, 2000
posts:12095
votes: 0


>>$AFF variable is empty

Aside from .htaccess issues, is your new affiliate tracking software working properly? Are orders tracking right?

2:54 am on Jan 8, 2008 (gmt 0)

New User

5+ Year Member

joined:Jan 7, 2008
posts: 5
votes: 0


No - I'm just beginning to plan the affiliate program and the first step was to look at how I'd pass the variable, set cookies, redirect and so forth.

So all I did was type in an example URL with the?AFF=ID at the end - and was surprised that the variable wasn't available on the page (I've checked by trying to echo the variable as well as getting through get_defined_vars)

Andrew

3:13 am on Jan 8, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


Give QSA (query string append) a try:

RewriteRule ^([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)/$ /index.php?VAR1=$1&VAR2=$2 [QSA,L]

3:15 am on Jan 8, 2008 (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


Ah, clearer now. In order to pass the AFF= name/value pair through the RewriteRule where you are passing the VAR1 and VAR2 parameters to /index.php, you will need to use the [QSA] --Query String Append-- flag on the rule. Otherwise, your VAR1/VAR2 parameters will replace the original AFF= query by default.

Merging [QSA] with your existing flag, use [QSA,L].

Jim

7:08 am on Jan 8, 2008 (gmt 0)

New User

5+ Year Member

joined:Jan 7, 2008
posts: 5
votes: 0


Thank you! Worked perfectly.