Reputation: 547
I am going to do my best to explain this. I have an affiliate site being setup. So they can go sign up, then the username they provide is written to the database. They can then access their affiliate site at www.domain.com/affiliate/username
.
I have my .htaccess file redirecting the url: www.domain.com/affiliate/home.php?affiliate=username
to www.domain.com/affiliate/username
I hope that makes sense. What I need is how to keep that username variable constant on the entire site. So if they are on the homepage of domain.com/affiliate/username
and they click on the About page or something else, I want to make sure it stays at domain.com/affiliate/username
. That way when the person goes to buy something, I make sure it is bought through the affiliate site, not the regular domain.com
site.
Any help is greatly appreciated. I am new to this, so bear with me please. Thanks!
Upvotes: 0
Views: 56
Reputation: 98005
3 approaches, quickly summarised, none of which have anything to do with mod_rewrite / .htaccess (making this an example of what I just learned is called the XY Problem):
If you really really wanted to do this with Rewrite Rules, you could probably combine it with the cookie option somehow: based on the cookie, redirect them differently. But I'm not sure there's much advantage to that, and forms that submit by POST will probably still need to be handled in the PHP layer as those are tricky to redirect consistently.
Upvotes: 1