Visitor-Dependent Content
Overview for easy method
There are occasions when it is desirable to restrict the visibility of webpage elements based on the IP address of the visitor. A common situation would be where a webpage is available to visitors both inside of a company firewall, but also by the world, where it is desirable to provide visitors outside of the company firewall with a different view.
Let's suppose you want to provide a link to an internal resource that only internal visitors will be able to access. Using some simple server-side include code you can display the link for internal visitors, but not for external visitors.
Approach
This turns out to be very easy to do using server-side includes (SSI).
Here's the easiest form.
<!--#if expr='-R "127.0.0"' -->
<p>
This content will only be seen on your local machine where your IP, typically, matches 127.0.0. I could've used 127.0.0.1 but it will match the portion you choose to include.
</p>
<!--#else -->
<p>
This content will be seen by all other visitors.
</p>
<!--#endif -->
Here's a little more complicated version.
<!--#if expr='-R "127.0.0"' -->
<p>
This content will only be seen on your local machine where your IP, typically, matches 127.0.0.xxx.
</p>
<!--#elif expr='-R "111.222.333"' -->
<p>
This content will only be seen by visitors from IP 111.222.333.xxx, an imaginary IP used for illustration purposes only. The idea is that you would use the IP of your organization so that the content seen here can be viewed by them, but not external visitors.
</p>
<!--#else -->
<p>
This content will be seen by all other visitors.
</p>
<!--#endif -->
A little more streamlined would be the following.
<!--#if expr='-R "127.0.0" || -R "111.222.333"' -->
<p>
This content will only be seen on your local machine or by visitors from IP 111.222.333.xxx.
</p>
<!--#else -->
<p>
This content will be seen by all other visitors.
</p>
<!--#endif -->
Summary
Using this technique allows you to build a single webpage, or entire site, that can be accessed by different visitor groups who need to have different information available to them. Visitors that are inside of your company's firewall may have links that shouldn't be displayed for external users, or the text may refer to material that is meaningless to external visitors. Whatever the reason, SSI provides a simple solution.