Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

Probably you still can use

<Location /foo/bar>
Order deny,allow
Deny from all
Allow from 192.168
</Location>
share|improve this answer
    
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 8 '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 8 '11 at 22:55
add comment

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!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.