Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:34:34+00:00 2026-06-01T17:34:34+00:00

been having this problem for a while! anyway i have downloaded Maxminds GEOIP php

  • 0

been having this problem for a while! anyway i have downloaded Maxminds GEOIP php module and uploaded it to my server then I put this section of code into my index.php page

<?php
require_once("geoip/geoip.inc");
$gi = geoip_open("geoip/GeoIP.dat",GEOIP_STANDARD);
$country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);

$my_countriesrow = array('AD','AE','AF'......and so on);
$my_countrieseuro = array('AN','AT','BA','BE','BG','BY'.......and so on);
/* $my_country = array('GB','UK'); */

if (!in_array(strtolower($country), $my_countriesrow)){
    header('Location: https://www.website.com/row/index.php');
    exit();
}
elseif (!in_array(strtolower($country), $my_countrieseuro)){
    header('Location: https://www.website.com/euro/index.php');
    exit();
}
else {
    header('Location: https://www.website.com/index.php');
    exit();
}
?>

I have uploaded the page to my server and in Google Chrome i am getting….
This web page has a redirect loop

The web page at https://www.website.com/index.php has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

same as in firefox! Anyone got any Ideas as I am all out….

Thanks in advance!

-Phillip Dews

UPDATE

OK HAVE DECIDED TO GO DOWN THE .HTACCESS ROUTE! I have edited my htaccess file to look like this….

GeoIPEnable On
GeoIPDBFile /geoip/GeoIP.dat

# Europe
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AM$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AO$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AQ$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AR$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AS$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AU$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AW$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AX$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AZ$
RewriteRule ^(.*)$ https://www.Website.com/europe$1 [L]

# Rest Of World
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AD$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AE$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AF$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AG$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AI$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AL$
RewriteRule ^(.*)$ https://www.Website.com/row$1 [L]

But for some reason I am getting a 500 internal error, even after putting in every singe country it is still not working for me! really dont know what to do now as I have been working on this for over a week using different php scripts and now this. Hope anyone can help Thanks again in advance, the reason Im asking is that there a lot of country codes to put in by hand so dont want to put them all in only to find it will not work! many thanks again!

-Phillip

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:34:36+00:00Added an answer on June 1, 2026 at 5:34 pm

    Well, if neither of your if statements matches, you’re redirecting to the /index.php. Since the code you’re editing serves index.php, the request to /index.php gets redirected … again, to index.php. You probably want:

    $my_countrieseuro = array('AN','AT','BA','BE','BG','BY'.......and so on);
    
    if (in_array(strtolower($country), $my_countrieseuro)){
        // European version
        header('Location: https://www.website.com/euro/index.php');
        exit();
    } else {
        // International version
        header('Location: https://www.website.com/row/index.php');
        exit();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having this problem for a while and it's driving me nuts. I'm
This is a really weird problem that I have been having. When I download
I have been trying to tackle this problem , but I am having difficulty
Hey, I've been having this problem for a while now and I was hoping
I have been stuck with this problem for a while now, and I just
So, i've been having this problem for a while now. Notepad++ NppFTP plugin fails
I have been having this problem wherein my threads stop execution and go into
This is a problem I've been having for a while and I'm hoping someone
I've been having this problem for a while now. I created a brand new
I've been stuck on this problem for a while now and have tried my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.