Forum Moderators: phranque
I have a dilemma that I am trying to solve for a client that is on an Apache server. I tried finding another post similar to our issues here, but I did not locate one. If I missed it, please accept my apology.
My client has a site (not owned by them) that is directing traffic from their site pages that lead directly to the clients content pages with an incorrect folder name that they appear to have created somehow.
The client does not mind the free traffic, but here's the issue they are having.
The site referring the traffic is adding "4u" to it's folder names of our clients folder name. The client folder does not have a "4u" in their directory.
Example: (non-existent domain name as example)
[myclient.com...]
It appears that every link the site refers to my clients site, it adds a "4u" to the folder named "coupons" on my clients site links it leads their visitors toward my clients site.
Unfortunately, my clients site folder name is called "coupons" and not "coupons4u" and it leads all referred visitors to their 404 page.
Is there a way that we can write a RewriteCond that would automatically correct the incorrect folder name "coupons4u" to auto-forward to a correct folder named "coupons" on my clients server? The page names all appear correct, it's just the folder name that appears to be incorrect.
Our logs indicate that the site sending the bad folder name links, uses 3 different referrer URL's according to our logs, as follows:
[referrer.com...]
[referrer.com...]
[subdomain4u.referrer.com...]
I would appreciate any insight, or advice you may provide in helping me resolve this issue for my client.
Your time is much appreciated. :)
Hmmm... Interesting problem, there. Here's a code sample to get you atarted. In .htaccess:
# Redirect requests referred by referrer.com for any page in /coupons4u/ to the corresponding page in /coupons/
RewriteCond %{HTTP_REFERER} http://([^.]+\.)?referrer\.com
RewriteRule ^coupons4u/(.*)$ http://www.example.com/coupons/$1 [R=301,L]
[edited by: jdMorgan at 11:56 pm (utc) on July 12, 2005]