Results 1 to 4 of 4

 

Thread: htaccess help required please

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    Yorkshire
    Posts
    136
    Thanks
    2
    Thanked 1 Time in 1 Post


    Hi all,

    I wonder if someone could possibly help with this question.

    Is it possible to block clicks coming from a site to my site and then redirect the person
    to another page using a htaccess file??

    Example:

    If I have a number of clicks coming from (example) banana123.com I would want
    those people to be redirected to a notallowed.html page

    I would also want it to catch people where banana123 is in any part of the url so
    news.banana123.com, banana123.co.uk, search.banana123.com etc - basically if
    banana123 is included in any part of the url.

    If anyone could help it would really be appreciated and probably save me a lot of grief :scared

    Many thanks

    Steve

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Jan 2008
    Location
    Yorkshire
    Posts
    536
    Thanks
    22
    Thanked 37 Times in 31 Posts
    I don't know about htaccess but if you are using php includes I suppose you add some code to your header? or just the page in question if all visitors are going to just one page to check if the referrer contains anything with banana123.com

    something like;

    PHP Code:
    if (strpos($_SERVER['HTTP_REFERER'], 'banana123.com') !== false){
    header("Location: http://www.mysite.com/notallowed.html");
    exit;


  3. The Following User Says Thank You to Andrew Starr For This Useful Post:

    OnlineMerchants (25-08-09)

  4. #3
    Registered User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    355
    Thanks
    0
    Thanked 22 Times in 19 Posts
    Hello Steve,

    You can add this code in your .htaacess :-

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} banana123\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} banana123\.co\.uk [NC,OR]
    RewriteRule .* – [F]
    </ifModule>

    Hope this works for you

  5. The Following User Says Thank You to Jack Russell For This Useful Post:

    OnlineMerchants (25-08-09)

  6. #4
    Registered User

    Status
    Offline
    Join Date
    Jun 2004
    Location
    Yorkshire
    Posts
    136
    Thanks
    2
    Thanked 1 Time in 1 Post
    Many thanks guys for replying - much appreciated!

    I got it in the end with:

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} banana123 [NC]
    RewriteRule .* notallowed.html [L]
    Seems to be working at the mo'

    Thanks again!

    Cheers

    Steve



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 301 .htaccess help
    By monkeyman in forum Programming
    Replies: 6
    Last Post: 18-10-06, 07:12 PM
  2. .htaccess
    By andy_jacko in forum Programming
    Replies: 2
    Last Post: 18-01-05, 02:27 PM
  3. who allows .htaccess?
    By talk4 in forum Web Hosting & Security
    Replies: 5
    Last Post: 24-03-04, 09:24 AM
  4. Help with .htaccess
    By ukhighstreet in forum Programming
    Replies: 1
    Last Post: 08-05-03, 02:22 AM
  5. .htaccess help
    By Nick in forum Programming
    Replies: 1
    Last Post: 19-02-03, 04:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2