I have to cope with Affiliate Monitoring on our website.

Within our .htaccess we've:

RewriteCond %{QUERY_STRING} affiliate=(.*)
RewriteRule ^(.*)$ $1?  [NC,R,L,co=AFFID:%1:%{HTTP:Host}:7200:/]

Which produces a COOKIE known as AFFID with the need for the URL Parameter affiliate.

However the Cookie isn't for the entire domain, i.e. Likely to http://www.domain.com/?affiliate=bmk sets the AFFID cookie using the value bmk for .www.domain.com but I'd like ti to become for .domain.com to ensure that you can use it across our secure domain which is secure.domain.com

Any help could be appreciated


Why not just hardcode it?

RewriteRule ^(.*)$ $1?  [NC,R,L,co=AFFID:%1:.domain.com:7200:/]

If you cannot do this, the you'd need to match the domain, such as this (untested):

RewriteCond %{QUERY_STRING} affiliate=(.*)
#This would work only for xxx.dom.com or dom.com forms, not for x.y.dom.com
RewriteCond %{HTTP_HOST} [^.]*?\.?([^.]+\.[^.]+) 
RewriteRule ^(.*)$ $1?  [NC,R,L,co=AFFID:%1:.%2:7200:/]