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

Need a little help with .htaccess

Discussion in 'BlackHat Lounge' started by wealthy199, Dec 22, 2007.

  1. wealthy199

    wealthy199 BANNED BANNED

    Joined:
    Sep 24, 2007
    Messages:
    585
    Likes Received:
    1,088
    I realise that you can choose to only allow people coming from certain sites to enter your site through the .htaccess but do not know the correct way to write this.

    For example, I only want people coming from http://www.x.com to be able to enter my site at http://www.y.com. I don't want anyone else to be able to view it.

    Can someone help me?
     
  2. Essential Clix

    Essential Clix Executive VIP Premium Member

    Joined:
    Jul 30, 2007
    Messages:
    1,755
    Likes Received:
    2,791
    Location:
    USA
  3. SmallStorm

    SmallStorm Junior Member

    Joined:
    Dec 4, 2007
    Messages:
    141
    Likes Received:
    64
    Here's another. The block hit-bots does the opposite of what you are wanting, but might give ideas. hxxp://www.htaccesstools.com/

    Chris
     
  4. wealthy199

    wealthy199 BANNED BANNED

    Joined:
    Sep 24, 2007
    Messages:
    585
    Likes Received:
    1,088
    Thanks essential and smallstorm. I managed to find my answer at the forum on htaccesstools.com. :)

    I'll post the code here if it works.
     
  5. Essential Clix

    Essential Clix Executive VIP Premium Member

    Joined:
    Jul 30, 2007
    Messages:
    1,755
    Likes Received:
    2,791
    Location:
    USA
    Yes, please keep us posted.
     
  6. wealthy199

    wealthy199 BANNED BANNED

    Joined:
    Sep 24, 2007
    Messages:
    585
    Likes Received:
    1,088
    No it doesn't work :(

    Bummer.
     
  7. aaappp3

    aaappp3 Newbie

    Joined:
    Dec 14, 2007
    Messages:
    34
    Likes Received:
    11
    Here's a bit of anti-hotlink code I adapted for you, haven't tested it so don't know if it'll work, I don't see why it shouldn't though:

    SetEnvIfNoCase Referer "^(.*)([./]+)x.com(.*)" local_ref=1
    SetEnvIfNoCase Referer "^(.*)([./]+)y.com(.*)" local_ref=1

    <FilesMatch ".(html|htm|php)">
    Order Allow,Deny
    Allow from env=local_ref
    </FilesMatch>

    Just replace x.com and y.com with your domains and save it as .htaccess, then upload to y.com. People should only be able to access html/php files on y.com if the referrer contains y.com or x.com. You'll have to update the FilesMatch bit to specify any other file extensions you're using on y.com (like .asp etc).
     
  8. durjoy

    durjoy Registered Member

    Joined:
    Dec 27, 2007
    Messages:
    86
    Likes Received:
    64
    dear small strom thanks a lot for htaccesstools link . awesome . happy sharing