Hello Everyone,

I need your help please, using htaccess, I like to know how to deny access to an index.php file from all visitors except me. I have tried the following;

<files index.php>
 order allow,deny
 deny from all
</files>

That works denying all access to that file. I would like an exception for my IP.

Thanks in advance.

Thanks broj1, however I only want to deny public access to one file "index.php" and not the entire website. I would like an exception for my ip.

Sory, I ommitted files directive for simplicity (but should have not :-). Will this work for you (provided that the path to index.php is correct):

<files index.php>
    order deny,allow
    deny from all
    allow from [your IP]
</files>

It works, i owe you one. Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.