[Resolved] Htaccess Rewrite Rule Issue

Status
Not open for further replies.
#1
Hi guys,

My name is Xavier and just joined the forum and have looked around a bit but all this coding is very alien to me.

I cannot seem to get a particular Htaccess redirect rule to work with Litespeed Web Server through my hosting provider Beyond Hosting. The content on my website has no affiliate link but provides the user relevant information about a product. Since there is no affiliate link to click then I need to drop the cookie in the user's browser in case they later decide to make a purchase based on the information I have provided on my website. I have been trying to get the affiliate cookie to drop using Htaccess and it is not working.

This is the following command:

Code:
RewriteEngine On
RewriteRule img1.jpg http://affiliatelink.com [R,L]
The HTML tag
Code:
<img src="img1.jpg" width=1 height=1 /> </img>
which I have in my landing page should reference Htaccess that it is calling the image. Since there is suppose to be no image the affiliate link is supposed to drop the cookie in the users browser.

I don't understand why it is not working, but I suspect that I have this in a domain directory rather than in the public root directory, but the problem is that I need my referrer to be the domain where my content is located. I contacted BeyondHosting with this problem but advised me to come to this forum for help as this is not their area of expertise.

Thanks for any help you can provide.
 
Last edited by a moderator:

NiteWave

Administrator
#2
>I need to drop the cookie in the user's browser
try this:
Code:
RewriteEngine On
RewriteRule img1.jpg http://affiliatelink.com [R,L,cookie=affiliatelink:1]
 
Last edited by a moderator:
#3
Thanks NeilWave. Before I proceed further, do I need to put my affiliate link as well in [R,L,cookie=affiliatelink:1] If so do I need to leave :1 the way it is?
 
#4
Ok NeilWave I just went ahead and left [R,L,cookie=affiliatelink:1] as is and just added my affiliate link into Htaccess rewrite and now my cookies are dropping. Thank you very much for your help and swift support! :)
 
Status
Not open for further replies.
Top