I have a wordpress multi-site server running on Ubuntu. I need to restrict access to two of the wordpress sub-sites to a specific subnet. For example:
http://www.mywp.com/jobs
http://www.mywp.com/apples
These two subsites are only access via 192.168.*.* ( or in CIDR notation 192.168.0.0\16), and 104.113.*.*
I have explored many options the most promising is the apache mod_rewrite approach; however, I have found that rewriting works for directories. Wordpress doesn't have a typical tree stucture, i.e.
http://www.mywp.com/jobs doesn't correspond to /var/www/jobs, and in fact
http://www.mywp.com/jobs doesn't have a single file or directory representation at all. Thus thus there is no corresponding .htaccess file for /jobs. I don't see how to attach a URL instead of a directory to the rewrite rule. Here are the rewrite concepts I have been playing with:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^192.168\. [OR]
RewriteCond %{REMOTE_ADDR} ^104\.113\. [OR]
RewriteRule ^(/jobs*)$ / [F,L]
</IfModule>
Which is also backwards as far as restriction goes since this redirects ../jobs to the home page.
Code:
<Limit GET POST PUT>
order deny,allow
deny from all
allow from 192.168.
deny from 104.113.
</Limit>
Which makes more sense to me but still doesn't attach to a URL. Can anyone suggest methods for restricting access to a URL based on IP without a per directory or .htaccess approach?