1

We need to block a specific URL for anyone not on a local IP (anyone without a 192.168.. address)

We however cannot use apache's

<Directory /var/www/foo/bar>
Order allow,deny
Allow from 192.168
</Directory>

<Files /var/www/foo/bar>
Order allow,deny
Allow from 192.168
<Files>

Because these would block specific files or directories, we need to block a specific URL which is created by mod-rewrite and the page is dynamically created using PHP.

Any ideas would be greatly appreciated

Alex
  • 113
  • 3

2 Answers2

2

Probably you still can use

<Location /foo/bar>
Order deny,allow
Deny from all
Allow from 192.168
</Location>
Alex
  • 7,789
  • 4
  • 36
  • 51
  • Should I be putting the URL before it was modified by mod-rewrite or the one the user sees in their browser? Thanks a lot by the way – Alex Feb 08 '11 at 22:42
  • I am not 100% sure, but I think you should put an original unmodified URL as it is in the browser. I think these directives are processed prior to invoking mod_rewrite handlers. – Alex Feb 08 '11 at 22:55
0

You can do this type of filtering with iptables. This does not work for HTTPS.

iptables -I INPUT -m string --string '/foo/bar' --algo bm -p tcp --dport 80 -j REJECT --reject-with tcp-reset

This is obviously hack style solution, but thats how i roll!

Ash Palmer
  • 347
  • 1
  • 8