Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question .htaccess and ip banning (and hello)

    hi everyone,

    i think i may have just found the definitive forums for my webmastering needs.

    i'm a fast and willing learner and if full/correct instructions are given can follow them to a tea.


    now then - i'm messing around with the magic of .htaccess and am coming to grips with it just dandy. i am up to here atm. i can ban users just fine so i'm happy. not that i need/want to. anyway i'd like to know if it is possible to ban a user using his ip for a specific directory only? as i tried now i can ban from the whole site only. i did place the .htaccess file into a directory i wanted to ban myself from but could still see it. so is this a case of you either ban the whole site or nothing ?

    and as a side note, regarding the complete ban, when i tested that, it worked just fine, and got this error:

    Forbidden

    You don't have permission to access / on this server.

    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


    1.) what number error is this ? (i'd like to use my own, as i have already customized 401, 403* and 404)

    2.) what's the problem it has with the 403 error ? could it be because i customized my 403 and as it tries to display it, it can not, since the html file is under /assets/html/403.html, and thus since the whole site is banned/blocked the user can not access it. sort of a catch 22 ???


    ok, then thanks.
    awaiting your swift reply!!!

    ps: credit to the writer of the tutorial i'm referring to.



    ps: does the .htaccess file have a syntax like other config files that you can rem lines out ? like for other files you may have: "rem" or "#" or ";" because i'd like to leave some stuff in there but have it disabled. make sense what i just asked ??


    pps: regarding this, i have done the last part, and both files are in upper case, and they both disappear after i upload them to site with ftp. when i go to the specific directory i can see the contents all right, but i see no top or bottom text (ie: the contents of either HEADER or README)



    * 403 works but i think i need to redo it as it's not exactly kosher. more on that later.
    Last edited by Mario_AU; 02-13-2008 at 02:04 PM.
    Pimp of Mario's World. Hater of society.

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    It's a 403 Forbidden. It even SAYS.

    Indeed, if you banned them completely, the document cannot be served up because of the restrictions on your webserver.

  • #3
    New Coder
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mario_AU View Post
    anyway i'd like to know if it is possible to ban a user using his ip for a specific directory only?


    ps: does the .htaccess file have a syntax like other config files that you can rem lines out ? like for other files you may have: "rem" or "#" or ";" because i'd like to leave some stuff in there but have it disabled. make sense what i just asked ??


    pps: regarding this, i have done the last part, and both files are in upper case, and they both disappear after i upload them to site with ftp. when i go to the specific directory i can see the contents all right, but i see no top or bottom text (ie: the contents of either HEADER or README)
    what about these 3 ??? plz
    Pimp of Mario's World. Hater of society.

  • #4
    New Coder
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    do you all have ===> set user{Mario_AU}./ignore ????
    and time is ok, but i see the "dreaded", generic "i need help" getting several replies ...from senior coders... hmmm. like judge judy would say, "OUTRAGEOUS".
    Pimp of Mario's World. Hater of society.

  • #5
    Regular Coder
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    924
    Thanks
    10
    Thanked 56 Times in 55 Posts
    http://tools.dynamicdrive.com/userban/

    Code:
    ## USER IP BANNING
    <Limit GET POST>
     order deny, allow
     deny from all.
     allow from xxx.xxx.xxx.xxx
    </Limit>
    
    ## PREVENT VIEWING OF .HTACCESS
    <Files .htaccess>
     order allow,deny
     deny from all
    </Files>
    Might work...

  • #6
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Do you have access to the httpd.conf to add Virtual Servers? Or is it only the owner who can do that? I have subdomains happening, I added the following to the httpd.conf:

    Code:
    <VirtualHost *:80>
        ServerAdmin you@email.com
        DocumentRoot /wwwroot
        ServerName www.server.com
        ServerAlias www.server.com
        RewriteEngine On
        RewriteOptions Inherit
    </VirtualHost>
    <VirtualHost *:80>
        ServerAdmin you@email.com
        DocumentRoot /wwwroot/subdomain
        ServerName subdomain.server.com
        RewriteEngine On
        RewriteOptions Inherit
        ErrorDocument 404 "/index.php"
    </VirtualHost>
    Then I have the following in the .htaccess files of both main root and subdomain root directories):

    For the main root's .htaccess:
    Code:
    <Limit GET PUT POST>
    order allow,deny
    allow from all
    </Limit>
    RewriteEngine on
    RewriteBase /
    For the subdomain's .htaccess:
    Code:
    <Limit GET PUT POST>
    order allow,deny
    allow from all
    </Limit>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^subdomain.server.com$ [NC]
    That works. If you try to access your subdomain and get no response whatsoever, your not configured for dns wildcards.
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.

  • #7
    New Coder
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by outseeker View Post
    Do you have access to the httpd.conf to add Virtual Servers? Or is it only the owner who can do that?
    no i don't...
    westnet is my host....


    but my question is rather regarding the .htaccess file itself, which i can modify. i did clearly state that i CAN ban a user from my site using the .htaccess option. i tried it, works just fine.

    i was just curious if using the .htaccess file (not by any other means) it would be possible to ban someone from a SPECIFIC directory rather then the COMPLETE site. that's all.


    also what's wrong with my HEADER/README code ??? i'd like to display a message in one of my directories that has VDL on.
    Pimp of Mario's World. Hater of society.

  • #8
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by Mario_AU View Post
    i was just curious if using the .htaccess file (not by any other means) it would be possible to ban someone from a SPECIFIC directory rather then the COMPLETE site. that's all.
    Yes Mario. Whatever directory you want to ban specific people from, just put an .htaccess file in that directory.

    Code:
    <Limit GET PUT POST>
    order allow,deny
    allow from all
    deny from 212.212.212.212
    #this is how yoo comment in .htaccess by the way Mario.
    </Limit>
    Just use deny from whatever IP you wanna ban from that directory. As for your PPS, what are you tryin' to do? cbf following the link, readn whatever, downloading etc. What you want help with there?
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.

  • Users who have thanked outseeker for this post:

    Mario_AU (02-17-2008)

  • #9
    New Coder
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    thanks,


    well at the moment when you got to: http://www.taxi583.com/temp/ you see this:

    Code:
    Index of /temp
    
      Name                    Last modified      Size  Description Parent Directory                             -   
    Apache Server at www.taxi583.com Port 80
    what you don't see is that there ARE two notepad text files in there called HEADER and README and they contain:

    hello from the top
    hello again from the bottom
    respectively.

    so shouldn't i get something like:
    Code:
    hello from the top
    Index of /temp
    
      Name                    Last modified      Size  Description Parent Directory                             -     Apache Server at www.taxi583.com Port 80 
    hello again from the bottom
    Apache Server at www.taxi583.com Port 80
    or similar ??? that's what i want. i want to say some crap at the top and something at the bottom too.


    oh and the .htaccess file is:

    Code:
    ## USER IP BANNING
    <Limit GET POST>
     order allow,deny
    #deny from 150.101.147.119
     allow from all
    </Limit>
    
    options +indexes
    that was the ip i was testing on myself, now commented out.. ;-)
    Last edited by Mario_AU; 02-17-2008 at 12:14 PM.
    Pimp of Mario's World. Hater of society.

  • #10
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    I can't see those files if I put their address in the bar.. http://www.taxi583.com/temp/header or http://www.taxi583.com/temp/readme both return 404 errors.

    Add this to your .htaccess for custom header etc.

    Code:
    HeaderName HEADER.html
    ReadmeName FOOTER.html
    That will display those files before and after your indexes (FIGJAM)

    You can also add FancyIndexing to your options +indexes to make the indexes more fancy. This allows you to sort by clicking on the top of a column, etc. The docs I read give HEADER.html and FOOTER.html as an example, I am sure they don't neccessarily need an extension of .html by the way.
    Last edited by outseeker; 02-17-2008 at 10:58 PM. Reason: Added FancyIndexing
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.

  • Users who have thanked outseeker for this post:

    Mario_AU (02-18-2008)

  • #11
    New Coder
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    that was it thanks,,,
    Pimp of Mario's World. Hater of society.


  •  

    Posting Permissions

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