Welcome to WebmasterWorld Guest from 54.205.88.118

Forum Moderators: Ocean10000 & incrediBILL & phranque

Rewrite Rule and affiliate ID problem

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

5+ Year Member



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)

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



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)

5+ Year Member



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)

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



>>$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)

5+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

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



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)

5+ Year Member



Thank you! Worked perfectly.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month