I want non logged in users to be redirected to the homepage which has a login/register form. After logging in all pages will be accessable.
I've added the following code to my header.php
<?php if( !is_user_logged_in() ) wp_redirect('http://krins.frisweb.nl' ); exit(); ?>
This worked locally (with a localhost url) but after uploading the site to a test subdomain it's causing an error: ERR_TOO_MANY_REDIRECTS
If I change the url to something else the redirect is working again but for some reason it breaks when replacing the url with the url of the homepage/site.
Thanks for your help.