The reason behind this is to track magazine ads. In magazine 'xyz' the ad I want to have says visit www.abc.com/xyz and then to have the htaccess in folder 'xyz' to log the visit and then redirect to my main page.
It begs the question "is this the best way" of tracking print ads. Seems to be very simple for the user.
Thanks
Tom
RewriteEngine On
RewriteRule ^/([a-z0-9]+) / [E=AFF:$1,L] This would set the environmental variable "AFF" to the name of the sub-directory. But you may want to qualify it as an affiliate code in case you have other subdirectories such as "images". eg: precede the sub name with "aff-", www.abc/aff-xyz:
RewriteRule ^/aff\-([a-z0-9]+) / [E=AFF:$1,L]