I need to redirect all users who don't have an 'allowed' IP-address to another subdomain. The users should be redirected to the other subdomain with the same URL.
For example:
dev.example.com/contact_us.php
=>www.example.com/contact_us.php
This part is now working with the following code in my .htaccess file:
RewriteCond %{REMOTE_ADDR} !^10\.0\.1\.1$
RewriteCond %{HTTP_HOST} ^dev\.example\.(.*)$ [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301,NE]
Besides that the domain can have different domain-extensions like: .com .net .pl .se
That means if the user try to navigate to dev.example.se/contact_us.php
and don't have an 'allowed' IP-address - then the user should be redirected to www.example.se/contact_us.php
I can't figure out how to make the second part working.