Home .htaccess file to block all IPs except 4 and always allow requests to /api/ for averyone
Reply: 0

.htaccess file to block all IPs except 4 and always allow requests to /api/ for averyone

user378
1#
user378 Published in June 19, 2018, 6:24 pm

I am trying to disallow all requests by

RewriteCond %{HTTP:X-FORWARDED-FOR} !=67.x.x.x
RewriteCond %{REQUEST_URI} !^api 
RewriteRule ^(.*)$ - [R=403,L]

ErrorDocument 403 "<html><hea....

So the IP 67 should be allowed for all REQ - but the directory /api/ should be accessible for everyone.

How can I do that?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.330358 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO