.htaccess file exists but not functioning

Discussion in 'Apache' started by champ_rock, May 3, 2007.

  1. #1
    hi

    i have a .htaccess in the root of my site where index.php is present

    /home/httpd/vhosts/XXXXXX/httpdocs

    i have banned an ip address using .htaccess using this code
    order allow,deny
    deny from XX.XX.XX.XX
    allow from all

    but still that ip is able to read my site.. i have tried banning my own ip and then accessing the site

    please tell me what is going wrong?
     
    champ_rock, May 3, 2007 IP
  2. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It sounds like the apache configuration files is not allowing you to override configuration settings. You will probably find the AllowOverride setting is set to None in the httpd.conf file. Changing to "All" may solve the problem.

    If you have shared hosting, your ISP may have disabled this.

    It is possible to block IP addresses from within your scripts. If you are using PHP to create all pages, you could add a ban function. Place this in a file which all scripts call.
     
    clancey, May 3, 2007 IP
  3. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #3
    I don't know what's the problem but the code should be something like this:

    <Limit GET POST PUT DELETE>
    Order Allow,Deny
    Deny from XX.XX.XX.XX
    Allow from all
    </Limit>
     
    VimF, May 3, 2007 IP
  4. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #4
    (i have a VPS Centos)

    changed that setting to ALL as u had said but still not working

    here is the my .htaccess file
    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^airb.us.to$ [NC]
    RewriteRule ^(.*)$ http://airb.us.to/$1 [L,R=301]
    
    order allow,deny
    deny from XX.XX.XX.XX
    
    allow from all
    
    Code (markup):
    the first code is supposed to redirect www. to the root of my doamin but when i access www.airb.us.to it is still not working :(

    also, the ip address is also not getting blocked
     
    champ_rock, May 3, 2007 IP
  5. cyanide

    cyanide Peon

    Messages:
    483
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Did you reboot apache afterwards?
    The changes won't take effect until you do
     
    cyanide, May 4, 2007 IP
  6. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #6
    ya restarted apache only
    then even did a reboot do the whole VPS.. but still does not work :(
     
    champ_rock, May 4, 2007 IP