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.

Block IP from accessing a certain page on website

Discussion in 'Apache' started by ademmeda, Dec 14, 2014.

  1. #1
    Hi,

    I have the following code in my .htaccess file to block an IP from accessing a file on my site and it works fine.

    <Files mypage.html>
    Order Deny,Allow
    Deny from XXX.XXX.XXX.XXX
    </Files>

    Is there a way to block an IP from accessing a page (e.g., mydomain.com/mypage/)? Thanks for a any ideas.
     
    Last edited: Dec 14, 2014
    ademmeda, Dec 14, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    I think you're misunderstanding something - mydomain.com/mypage/ will just be either an actual folder on the server, or a rewrite (most likely with .htaccess) for mypage.html?id=235 for instance (to get _your_ mypage). So depending on what /mypage/ is really, this should be fairly simple). But it would help to know what it really is.
     
    PoPSiCLe, Dec 14, 2014 IP
  3. ademmeda

    ademmeda Active Member

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    3
    Trophy Points:
    70
    #3
    It's a rewrite with .htaccess.

    mydomain.com/page.php?page=mypage
    >>>
    mydomain.com/mypage/

    I want to block access to only /mypage/, not all pages.
     
    ademmeda, Dec 15, 2014 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    So, is the mypage an actual page, or a call to a database based on mypage and perhaps other settings? If the file exists, you can just base it on the original filename.
     
    PoPSiCLe, Dec 15, 2014 IP