How can I configure Apache to use HTTPS for external access but HTTP for internal access?

I'm going to make the assumption that you do accept HTTP connections for the public, but you do a standard HTTP redirect to force them to HTTPS.

If this is the case, then you can alter your HTTP directives to not redirect if you are part of the internal network.

To do this, you want to use Apache's mod_rewrite and filter on REMOTE_ADDR. Essentially, you want to redirect everything that does not match your network.

The other option, and probably the safer one, is to just have your internal users use a different service address than the public one. Have them connect to myservice.mydomain.local instead of myservice.mydomain.com.


Can you create 2 different virtual hosts in the Apache config, each that respond on different IPs, although still use the same doc root? On your router, have it respond to example.com with 192.168.1.1, while outside it will respond with 342.434.564.23. Or have everyone use a different address when they are in the office (internal.example.com).