I need .htaccess code that will:

Restrict a specific IP from a specific page.
Allow that IP on any other pages but the restricted one.

I already tried this and it does not work:

<files submit.php>
order allow,deny
deny from 1.2.3.
deny from 1.2.
allow from all

Does anyone know a better way, maybe using mod_rewrite?

Recommended Answers

All 2 Replies

I thought of using mod_rewrite is an alternative if 'deny from' wasn't working. It turns out I had a bad Apache build. When I rebuilt Apache, the 'deny from' code I posted in the first place ended up working.

Be a part of the DaniWeb community

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