Welcome to WebmasterWorld Guest from 54.166.191.112

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

how to control redirects from other domains

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

Junior Member

10+ Year Member

joined:Feb 2, 2006
posts: 79
votes: 0


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 June 27, 2011 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:13056
votes: 299


Your magic words [httpd.apache.org] are

%{HTTP_REFERER}

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

Junior Member

10+ Year Member

joined:Feb 2, 2006
posts: 79
votes: 0


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 June 27, 2011 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:13056
votes: 299


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 June 27, 2011 (gmt 0)

Senior Member

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

joined:July 3, 2002
posts:18903
votes: 0


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 June 27, 2011 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 2, 2006
posts: 79
votes: 0


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!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members