I am trying to restrict a specific URL to be available outside the network only to specific IP addresses. When a user outside tries to access that URL and not from the list of IPs he should be redirected to the homepage.
This is what I've tried so far without any luck. The last part it redirects everyone to the homepage regardless of IP.
<Location "/secret">
# <If "%{REMOTE_ADDR} != -ipmatch '123.123.123.123/255.255.255.255'">
# Redirect 303 "/secret" /
# </If>
RewriteCond "%{REMOTE_ADDR}" "!123\.123\.123\.123"
RewriteRule .* / [R,L]
LogLevel debug rewrite:trace6
</Location>
PS: the /secret URL is in fact a virtual URL and does not exist physically on the drive.