1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to allow traffic from certain referer

Discussion in 'Black Hat SEO' started by peetrike, Dec 13, 2013.

  1. peetrike

    peetrike Power Member

    Joined:
    Aug 19, 2012
    Messages:
    585
    Likes Received:
    219
    Location:
    Estonia
    I would like to allow traffic only from certain referral sites (not exact domain but from all domains containing a certain word or phrase) and also allow visits from crawlers (googlebot, yahoobot and so on). For others i would like to show some text like "website under maintenance" or similar.

    How it`s possible?

    Thanks
     
  2. Falrish

    Falrish Regular Member

    Joined:
    Jun 28, 2010
    Messages:
    313
    Likes Received:
    97
    Occupation:
    Manager, IT & Purchasing
    Location:
    Canada
    Home Page:
    That is done through .htaccess programming or PHP.

    You have to utilize ReWrite Engine. If you would like a little more information let me know and I will help you out.
     
  3. Cryptocurrency

    Cryptocurrency Registered Member

    Joined:
    Dec 12, 2013
    Messages:
    62
    Likes Received:
    14
    .htaccess is what you require, i suggest you google it.
     
  4. peetrike

    peetrike Power Member

    Joined:
    Aug 19, 2012
    Messages:
    585
    Likes Received:
    219
    Location:
    Estonia
    Is it also possible to create as plugin for WP? Where i could change the referers and text to show to other visitors? I have used cloaking plugins where i can redirect the traffic but it`s not exactly the same what i would like to have.
     
  5. Tensegrity

    Tensegrity Elite Member

    Joined:
    Apr 22, 2009
    Messages:
    1,846
    Likes Received:
    976
    You don't necessarily need to use .htaccess, especially since .htaccess only works on Apache and can get complicated if you are new to it.

    if you go the PHP route, you can look for the referrer with $_SERVER['HTTP_REFERER'] and use strpos() to look for a specific string (such as the domain).

    if you want to use Javascript, you can look at document.referrer;
     
  6. TZ2011

    TZ2011 Senior Member

    Joined:
    Jun 26, 2011
    Messages:
    833
    Likes Received:
    864
    He is asking for ready-to-go solution, like wordpress, so probably would not bother with .htaccess, php and js.
     
  7. Falrish

    Falrish Regular Member

    Joined:
    Jun 28, 2010
    Messages:
    313
    Likes Received:
    97
    Occupation:
    Manager, IT & Purchasing
    Location:
    Canada
    Home Page:
    Yes it can be created as a plugin for Wordpress. it would entail a lot more work than a simple set php script that redirects certain worded referrers to certain pages and then all others get the boot.
     
  8. Bartholomew

    Bartholomew Regular Member

    Joined:
    Dec 31, 2009
    Messages:
    290
    Likes Received:
    104
    Home Page:
    Look up the script in my signature.
    It can do this.
     
  9. bartosimpsonio

    bartosimpsonio Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 21, 2013
    Messages:
    12,295
    Likes Received:
    11,035
    Occupation:
    CHEAP
    Location:
    LINK LISTS
    Home Page:
    Just add this to the top of your php pages. And no, I don't think this is a good idea.

    Code:
    <?php
    
    
    if (!preg_match("domain\.com",$ENV['HTTP_REFERER'])) {
    Header( "HTTP/1.1 301 Moved Permanently" ); 
        Header( "Location: http://www.redtube.com/?hint=fuck_off" ); 
    } 
    
    ?>