Dirty Bird Design
Dirty Bird Design

Reputation: 5553

Block IP access to specific page only

I need to block access from a certain IP address to one page of a website only, not the entire website.

Here's what I have, but doesn't seem to be working (I switch out offending IP to mine and am still abel to access after refresh/cache dump etc)

<Files specificpage.php>
    order deny,allow
    deny from XX.XXX.XXX.XX
</Files>

Is there a better way of doing this or does anything jump out here? thx

Upvotes: 0

Views: 277

Answers (1)

anubhava
anubhava

Reputation: 786291

You can actually mod_rewrite rules for finer control here. Place this in your root .htaccess:

RewriteEngine On

RewriteCond %{REMOTE_ADDR} =XX.XXX.XXX.XX
RewriteRule ^specificpage\.php$ - [F,NC]

Upvotes: 1

Related Questions