1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to create a .htaccess file

Discussion in 'Apache' started by Spetto, Aug 27, 2005.

  1. #1
    We work in an nonprofit website about contability and we have been targeted by a lot of people who worked in this area.
    This week, a guy took something like a thousand pages from us althought we had a robots.txt file in place which blocked all pages in the restricted area.
    I was trying to find a way solve it when I found a Thread here in Digital Point where gatordun showed a piece of a .htaccess file to block bots and other programs. It seems to me that this file block agents in the server level and doesn't depend on the bot creator, so it is best to control traffic in an website. Is that correct?
    I'd like to know how to create a .htaccess file to block all kinds of bots and programs or where I can take a look in some information about it.
    We have a big website so I'dl like to know if it's necessary to put one file in each directory or if it blocks all files beyond the directory it is put.
    Thank you for any help.:)
     
    Spetto, Aug 27, 2005 IP
  2. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #2
    open up text pad/note pad and go to "save as" and save as .htaccess
    do not forget the . (DOT)

    you can put the file in main directory, and/or sub-directory, if its in main directory only it will control all sub-directories too.
     
    just-4-teens, Aug 27, 2005 IP
  3. Spetto

    Spetto Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    For exemple, in the Thread I saw, there were these lines..

    RewriteEngine on RewriteCond %{HTTP_USER_AGENT} !^$
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
    .
    .
    .
    RewriteCond %{HTTP_USER_AGENT} ^Zeus
    RewriteRule ^.* - [F,L]

    Is it possible to substitute the names of the programs for *? If it's done, do the browers continue to access webpages on these directories?
    What is the meaning of the 1°, 2° and last line?
    Thank you again.
     
    Spetto, Aug 27, 2005 IP
  4. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #4
    there is a difference between controlling crawlers / bots that are behaved and using .hataccess to exclude offenders.

    http://www.searchengineworld.com/robots/robots_tutorial.htm

    give a good idea about robots.txt file which controlls behaved bots like google etc.

    .htaccess can be used to block known offenders that do not use the IP switching method, or then by host name.

    Check if you have an existing .htaccess ( no endings like .txt etc) as a lot of hosting providers issue one.
    Also if you have hosting with cpane it is easier to use this to control your .htaccess file.

    deny entries for ip's look like


    order allow,deny
    deny from 123.45.6.7
    allow from all

    check for htaccess on google as it is used for a lot more....

    Expat
     
    expat, Aug 27, 2005 IP