I'm wondering if anyone knows how to approach this predicament I am facing using .htaccess.
I have a website that is accessible using 2 different domains. For one of the domains, I only want the website to be accessible to a subset of IPs only (about 30 of them). The second domain, can be open to anyone.
So for example:
restricted.domainexample.com can only be accessible from IPs 1.1.1.1, 2.2.2.2, 3.3.3.3
www.domainexample.com can be accessible from everyone.
I have the following, but not sure if this will work. Is it along the right path?
RewriteEngine on
RewriteCond %{HTTP_HOST} ^restricted\.domainexample\.com$ [NC]
order deny,allow
deny from all
allow from 123.12.12.12
allow from 123.123.43.43
RewriteRule ^(.*)$ - [F]
Of course www.domainexample.com is untouched here, so that should still have full access by all. Any input and help is greatly appreciated.