Welcome to WebmasterWorld Guest from 23.23.46.20

Forum Moderators: Ocean10000 & incrediBILL & phranque

how to control redirects from other domains

   
5:15 am on Jun 27, 2011 (gmt 0)

5+ Year Member



I control the website at URL#1. I do not control URL#X nor URL#Y. Both URL#X and URL#Y contain backlinks to URL#1. I want to redirect traffic that arrives from URL#X to URL#2. However, I do not want to redirect traffic that arrives from URL#Y to URL#2. Is this possible?

In other words, simply adding the following to .htaccess will redirect all traffic from URL#X and URL#Y to URL#2. This is not what I want.
Redirect 301 URL#1 URL#2

Thank you for your help.
5:28 am on Jun 27, 2011 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Your magic words [httpd.apache.org] are

%{HTTP_REFERER}

Don't look at me. It's their spelling.
5:55 am on Jun 27, 2011 (gmt 0)

5+ Year Member



Thanks Lucy! I did look at [httpd.apache.org...] but I still don't know how to construct the directive. (I'm self-taught, but my teacher is a newbie :o Based on my example, can you help?
8:01 am on Jun 27, 2011 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



RewriteCond %{HTTP_REFERER} ickysite/whose/visitors/youdon'twant
RewriteRule \.html?$ http://www.example.com [R=301,L]

The RewriteCond is a Regular Expression so you only need to give enough information to make it unique. (I've got one that says in full \.(ua|su|mobi)/ for example. 100% of my referers from these extensions are forged.)

The RewriteRule only gives the end of the address, because you're kicking out people who request any page. Or, ahem, sending them to a place where you're certain they would be a lot happier. This includes people who just type in "www.example.com", because server magic has already changed that into a full address.

All this is assuming that URL#2 is waiting with open arms to receive your unwanted guests. Ahem. Oh, and I assumed that when you said URL you meant "domain". Otherwise you have to make the RewriteCond a little more detailed.
8:48 am on Jun 27, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



When redirecting to a domain, a trailing slash is required in order to specify the root page.

However, I would not redirect.

I use
RewriteRule <pattern> - [F]
where
<pattern>
specifies which URL requests to block.
8:55 pm on Jun 27, 2011 (gmt 0)

5+ Year Member



Hmm, not sure about what to do G1 and Lucy. When you wrote "ickysite/whose/visitors/youdon'twant" I got the idea that your regex will not do what I want: I do want visitors from URL#X and URL#Y at URL#1. I just don't want peeps from URL#Y to be redirected to URL#2 (as stated in the first para.) Not redirecting is a big difference from "kicking out people".

Please, please give the actual RewriteRule/RewriteCond example using the "URL#X" etc. examples, so that we stay on the same page. TIA!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month