A
A
Alexander2019-05-01 22:57:11
htaccess
Alexander, 2019-05-01 22:57:11

How to allow access to only 1 page?

There is a site in the local network, a smart home and all that. He has an API for VK and other nonsense :) The site was transferred from hosting to my machine and now I'm sitting thinking :)
I need to allow access to the API directory to everyone, and close access to the rest of the site to everyone except for local network devices ...
I understand that I need to write a rule in htaccess, but I don't know how :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Syomka Gavrilenko, 2019-05-01
@SmoKE_xD

In the root directory create a .htaccess file and write:

Order Deny,Allow
Deny from all
Allow from 10.0.0.0/8
Allow from 100.64.0.0/10
Allow from 172.16.0.0/12
Allow from 192.168.0.0/16

in api folder create .htaccess file
Order Allow, Deny
Allow from all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question