I have sifted through all the top results in google for a way to redirect a user based on the referer data. I want to refer visitors from 1 site and 1 of its subdomains to an article when they visit the site. From everything I have read I came up with the following: RewriteEngine On RewriteCond %{HTTP_referer} ^http://(www\.)?example\.com/ [NC] RewriteCond %{HTTP_referer} ^http://subdomain\.example\.com/ [NC] RewriteRule .* http://www.mysite.com/article/ [R,L] Code (markup): I have not been able to test the subdomain rewrite condition but the domain one does the redirect but gives the following error: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. From what I've read it is probably looping? I have SEF urls enabled through joomla, not sure it matters or not. I real have no knowledge of this but have always found solutions with google. Any help would be great. Thanks
RewriteEngine On RewriteCond %{HTTP_referer} ^http://(www\.)?example\.com/ [NC] RewriteCond %{HTTP_referer} ^http://subdomain\.example\.com/ [NC] RewriteRule .* http://www.mysite.com/article/ [R=301,L] Code (markup): adding the =301 tells the browser that the page has been moved so follow the redirect
thanks for the reply but it seems to still be causing an infinite loop and redirecting to itself? Is there a way to clear the referer info so this doesn't happen or exclude it from that specific article?
Options +FollowSymLinks RewriteCond %{HTTP_referer} ^http://(www\.)?example\.com/ [NC[B],OR[/B]] RewriteCond %{HTTP_referer} ^http://subdomain\.example\.com/ [NC] RewriteRule [B]^$[/B] http://www.mydomain.com/article/ [R=301,L] Code (markup): The above now works for the example.com...I can't test from the subdomain but I will assume it also now works...anyone know how to test by manually adding the referrer info in your browser?
Are you sure you want to do a 301 redirect? This essentially means "Moved Permanently", so if for example, a search engine followed the link from the referrer site, it would assume your normal page has been "Moved Permanently". btw, looks like you've got everything else working properly, including the ,OR to evaluate the second condition. I'm just worried you might be redirecting search engines (unless that's what you want) ??
The website that is referring is all no follow and it is an ad on that site that users click through. I never thought about the SE issue that could arise but I think since its no follow and an ad I shouldn't have any issues with mainly google. Am I right with this thinking?
The nofollow attribute applies to the passing of Pagerank. Google definitely follows all links for general indexing purposes. I can tell you that for certain because the simplest trick to get indexed in Googe is to post a comment on DoshDosh, TechCrunch or Shoemoney but all those blogs have nofollow comments.
So could google follow one on those links and take my site out of the index even though other sites that they index point to my site and the site exists through those? Should I take the 301 away and change it to something else?
I'm not sure if it would take you out of the index but it could cause issues with duplicate content. If it were my site, I think I'd avoid using the 301. One of the best articles I've found on the subject is here. btw, if you need to test your redirects, I have a few domains with subdomains and could easily put up a couple of test pages, PM me if necessary.