Gossamer Forum
Home : General : Perl Programming :

Apache > htaccess > RewriteCond

Quote Reply
Apache > htaccess > RewriteCond
.htaccess snippet:

RewriteCond /full/path/to/%{REMOTE_ADDR} !-f
RewriteRule /* /script.cgi [L,R]

Interpretation: if file not found named as users' IP address, they are redirected to script.cgi.

But I would like to expand this as follows: test the condition using x (where x = 1, 2, 3, 4) predefined number subnets in the IP address. For example, it could be defined to use the first 2 subnets (x = 2) - the IP address, 12.34.77.88 would return true if 12.34.77.99 file existed, and the user is not redirected to script.cgi.

Any takers?


Dan Cool