Search code examples
htmlintranetsubnet

HTML - make some pages only accessible through IntrAnet \ some SUBNET


i have certain pages in my website that i would like to only be accessed from the LAN which is within my organization... now those pages are a part of my website because they interact with the database and all... how to do it

Now i can make them password protected... but i want to make them inaccessible to the rest of the internet and only display them (without password auth.) and links to them in other pages when they are opened from a subnet\LAN of the company...

HOW TO DO IT....

what if i want to extend this from one subnet to multiple subnets like a ACL- Access Control List


Solution

  • If you use apache server you can use rewrite mode in .htaccess file.

    RewriteCond %{REMOTE_ADDR} ^12\.34\.56\.78$ [OR]
    RewriteCond %{REMOTE_ADDR} ^87\.65\.43\.21$
    RewriteRule .* - [F]
    

    In this example you block two IP adresses, you can use Regular Expressions to block IP adresses outside your network.