Your code redirects to “/ie/” also if you are already on “/ie/”. The easiest way to prevent this is by changing
if( $country == 'IE' ) {
to
if( $country == 'IE' && substr( $_SERVER['REQUEST_URI'], 0, 4 ) != '/ie/' ) {
Your code redirects to “/ie/” also if you are already on “/ie/”. The easiest way to prevent this is by changing
if( $country == 'IE' ) {
to
if( $country == 'IE' && substr( $_SERVER['REQUEST_URI'], 0, 4 ) != '/ie/' ) {