Results 1 to 6 of 6

Thread: Ban certain IP

  1. #1
    1901gt is offline Web Designer
    Join Date
    Jan 2009
    Location
    Singapore
    Posts
    235
    Blog Entries
    2
    Thanks
    35
    Thanked 32 Times in 24 Posts

    Ban certain IP

    How do I ban certain countries IP Address via .htaccess?
    I use the one at BlockACountry.com but for the past 12 hours, I still see more than 20 spammers with Ukraine, Russia and UK ip address registering.

    I have added the "NoSpam! Verification Question" vbulletin mod, but they still managed to pass through it.

    Any idea?

  2. #2
    Coastercraze's Avatar
    Coastercraze is offline Net Builder Legend
    Join Date
    Jan 2009
    Location
    Under powerlines
    Posts
    499
    Blog Entries
    3
    Thanks
    94
    Thanked 59 Times in 48 Posts
    Quote Originally Posted by 1901gt View Post
    How do I ban certain countries IP Address via .htaccess?
    I use the one at BlockACountry.com but for the past 12 hours, I still see more than 20 spammers with Ukraine, Russia and UK ip address registering.

    I have added the "NoSpam! Verification Question" vbulletin mod, but they still managed to pass through it.

    Any idea?
    Make the question difficult like what is the speed of light times the speed of sound that'll stop it

    Actually you can ban whole ranges in vBulletin too like 122.* is one that I banned cause that's like 60% of my spammers.
    Webmaster Forums
    Host Mist | Shared | Reseller | VPS | Dedicated
    Arcade Master - Rule the arcade!

  3. #3
    Will.Spencer's Avatar
    Will.Spencer is offline Retired
    Join Date
    Dec 2008
    Posts
    5,033
    Blog Entries
    1
    Thanks
    1,010
    Thanked 2,327 Times in 1,258 Posts
    Quote Originally Posted by 1901gt View Post
    How do I ban certain countries IP Address via .htaccess?
    I use the one at BlockACountry.com but for the past 12 hours, I still see more than 20 spammers with Ukraine, Russia and UK ip address registering.
    You're certain that the IP addresses which are gaining access are the same ones that you have blocked?

    Is it possible that your http.conf is not configured to allow Deny statements in that the relevant directories .htaccess file?

    This requires the AllowOverride permission for Limit.

    In your httpd.conf file, you will need to find the AllowOverride section which is relevant to that directory. There is likely to be more than one AllowOverride statement, so make certain you are looking at the right one.

    On my system, the section looks something like this:

    Code:
    <Directory "/usr/local/www/data">
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
        AllowOverride Options FileInfo AuthConfig Limit
    </Directory>
    Submit Your Webmaster Related Sites to the NB Directory
    I swear, by my life and my love of it, that I will never live for the sake of another man, nor ask another man to live for mine.

  4. #4
    1901gt is offline Web Designer
    Join Date
    Jan 2009
    Location
    Singapore
    Posts
    235
    Blog Entries
    2
    Thanks
    35
    Thanked 32 Times in 24 Posts
    Where to find the httpd.conf file?
    Is it in the ftp public_html folder?

    I have .htaccess and htaccess.php in my public_html folder. Not sure why there's 2 htaccess files in there.

    In my .htaccess file, it looks something like this:

    # Comment the following line (add '#' at the beginning)
    # to disable mod_rewrite functions.
    # Please note: you still need to disable the hack in
    # the vBSEO control panel to stop url rewrites.
    RewriteEngine On

    # Some servers require the Rewritebase directive to be
    # enabled (remove '#' at the beginning to activate)
    # Please note: when enabled, you must include the path
    # to your root vB folder (i.e. RewriteBase /forums/)
    #RewriteBase /

    #RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
    #RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]

    RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

    RewriteCond %{QUERY_STRING} !vbseourl=
    RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
    RewriteRule ^(.*\.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]

    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif)$
    RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
    RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]

    <Limit GET HEAD POST>
    order allow,deny
    deny from 58.147.128.0/19
    deny from 117.55.192.0/20
    deny from 121.100.48.0/21
    .
    .
    .
    deny from 217.199.224.0/20
    allow from all
    </LIMIT>

  5. #5
    Will.Spencer's Avatar
    Will.Spencer is offline Retired
    Join Date
    Dec 2008
    Posts
    5,033
    Blog Entries
    1
    Thanks
    1,010
    Thanked 2,327 Times in 1,258 Posts
    On my system, the httpd.conf file is at /usr/local/www/data/apache22/httpd.conf.

    You system is likely different.

    If you have shell access, you can use this command to find all httpd.conf files on your system:
    Code:
    find / -name httpd.conf -print
    If you don't have shell access, you should probably just ask your hosting company why .htaccess isn't working.

    Also, you can block IP addresses in vBulletin. In the vBulletin AdminCP, go to vBulletin Options and then to User Banning Options.
    Submit Your Webmaster Related Sites to the NB Directory
    I swear, by my life and my love of it, that I will never live for the sake of another man, nor ask another man to live for mine.

  6. #6
    elbandelero's Avatar
    elbandelero is offline Net Builder
    Join Date
    Dec 2008
    Location
    Spain
    Posts
    544
    Thanks
    209
    Thanked 105 Times in 79 Posts
    If you host provides cPanel, you can also paste the list of IPs you got from blockacountry into the IP banning module. Not sure if this will overwrite your htaccess, so make a backup of that first if you have anything in it other than the block country list.

Tags for this Thread

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
  •