How to redirect traffic that comes from certain URL to another
Not always you will be in this situation, where you don’t want people to visit your site (that come from certain site). Because usually everybody wants traffic to their site, the more the better.
But last week I was in an awkward situation where I didn’t want traffic that came from certain domain name. Regular readers of my blog already know this, I had sold one of my sites to someone (don’t want to mention his particulars out of respect). I had forgot to remove my personal information from the website.
Basically the site contained an introductory text that said “this is my project, purpose of the project, my name and my other sites”. Unfortunately, the new owner didn’t want to remove the info, and tried to push adware to the people who wanted to download free icons.
Obviously, I was furious, and sent numerous emails to him. At the end, he removed my particulars. But during this one week time, much damage was done (especially to my reputation). I had received emails telling me that I had cheated them, instead of giving them free icons I pushed them adware… basically, dissatisfied users! And they thought I am doing all these. That was the worst part. So I had to do something.
So, one of the solutions before the new owner removed my personal info was to redirect the traffic that was coming from this website to a particular page. A page that contained all the info and explained the user that the site was sold and no longer belonged to me. I also explained that it was unfortunate that the new owner took this direction for the new site. Lastly, I provided a direct download link to the free icons.
So how this is done? This redirection is done through .htaccess.
Redirecting users that come from certain URL to another
Here is the main code that should be put in your .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} referrerURL\.com/
RewriteRule ^$ www.redirectedURL.com [R=301,L]
Now let’s do some explanation.
This code RewriteCond %{HTTP_REFERER} referrerURL\.com/ detects the traffics that come from different websites. If the traffic comes from referrer dot com then the second command is true:
Second command says RewriteRule ^$ www.redirectedURL.com [R=301,L] , i.e if the previous command is true then redirect the traffic to www.redirectedURL.com. Please note that you can be specific about this, you can even point it to specific page eg: www.redirectedURL.com/specific_page.html etc.
Conclusion
I hope you won’t be in this situation, but if you do then remember that there is a solution for it. At least temporary one.
For more tips sign up for my RSS.
Related Posts
- .htaccess basics
- Tip: Increase your blog’s chances to get Stumbled(Upon)
- Why you should redirect yourblog.com to www.yourblog.com
- WP Plugin: all-in-one htaccess plugin
- Solution to hotlinking
9 Responses
to “How to redirect traffic that comes from certain URL to another”
1 Trackback(s)
- Apr 11, 2008: AdesBlog.com » Tip: Increase your blog’s chances to get Stumbled(Upon)










By Nicole Price on Mar 31, 2008
Wow I didn’t know this kind of conditional redirection could be done based on referring url. Very useful information.
By Rice Blogger on Apr 1, 2008
that is great….lesson learned…:)
By Free Money maker on Apr 2, 2008
hello dear I have some query about redirecting url.How to make a htaaccess file ? Where to be inserted this code?I want one blog traffic redirect to another blog.If you pls help me in details then it would be better to understand for me.Thanks.
By seo blog on Apr 2, 2008
I can’t believe i never used this. I always just blocked the traffic from certain urls or IPs but never redirected it.
By Eva White on Apr 4, 2008
This is something new I have learned….thanks for the links and info.
By David Bradley on Apr 11, 2008
This is a super tip. I get a lot of traffic from an educational website that simply links to my homepage, but having created a portal-type page it makes much more sense to redirect those visitors to that page, which is tailored just for them. I’m going to apply this principle to a few other pages! Thanks again.
db
By David Bradley on Apr 11, 2008
Hello again…
How would you use this rule with 2-3 referrers you wanted to send to a specific page, and a different 2-3 you wanted to send elsewhere?
db
By Rick Lim on Aug 23, 2008
Thanks for this tutorial. I had been wondering how to do that until i read this.