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

  • SEARCH
  • Home
  • 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 936467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:19:10+00:00 2026-05-15T21:19:10+00:00

I am trying to redirect my visitors to for example http://localhost/site/test.php?lang=en_US based on the

  • 0

I am trying to redirect my visitors to for example http://localhost/site/test.php?lang=en_USbased on the country code in the cookie like this:

if (isset($_COOKIE['country'])) 
{
        $country = $_COOKIE['country'];
        header('Location: test.php?lang=en_US');  

        if ($country == "NO"){              
        header('Location: test.php?lang=no_NO');    
        }                       
}
else
{
    header('Location: test.php?lang=en_US');  
}

But i get this weird error in firefox: The page isn't redirecting properly

Found a solution:

if (!isset($_GET['lang']))
{

        if (isset($_COOKIE['country'])) 
        {
                $country = $_COOKIE['country'];
                $redirect = "en_US";

                if ($country == "NO"){              
                $redirect = "no_NO";    
                header('Location: crime.php?lang='.$redirect); 
                }   

                if ($country == "EN"){              
                $redirect = "en_US";    
                header('Location: crime.php?lang='.$redirect); 
                }   

        }
        else
        {
            header('Location: crime.php?lang=en_US'); 
        }


}       
  • 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-05-15T21:19:11+00:00Added an answer on May 15, 2026 at 9:19 pm

    The problem is that it is unconditionally redirecting, and always to itself, causing an infinite loop which Firefox detects and stops. You need to add conditions to prevent redirects once the final page has been reached.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I'm trying to do is to redirect my website visitors who enter example.com
I'm trying to redirect URLs from example.net/customname or example.net/customname/ to example.net/my/home.php?username=customname . This in
I'm trying to redirect requests for a wildcard domain to a sub-directory. ie. something.blah.example.com
I'm trying to redirect site.com w.site.com ww.site.com and wwww.site.com to www.site.com. My boss wants
I'm trying to redirect index.php files to the root /, I've searched around and
I am trying to redirect all traffic through index.php. Here is my .htaccess file:
I'm trying to redirect a page using javascript output using php. The problem I'm
I'm trying to redirect a user to a url containing his username (like http://domain/username/
I'm trying to redirect every visitor that tries to enter my homepage (http://www.mysite.com/) to
I'm trying to redirect API calls to api.php with parameters, but it doesn't work.

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.