skip to Main Content

Hope you are doing well

I am having issue with one URL, https://www.example.com/dashboard

Here i have condition if user is not loggedin then it should redirect at home page , Due to this reasn my above url is showing 302 found error in seo , How can i allow this url in seo as 200 status beaucse url is correct but it reidirect beaucase user is not logged in
public function index($id=1){

 if($this->input->cookie('country')) {
            $countryId = $this->input->cookie('country');
        }
        else{
            //$countryId = $id;
            redirect(base_url());
        }

Technology is in codiginiter

2

Answers


  1. Chosen as BEST ANSWER
    $agent = $this->request->getUserAgent();
    
    if ($agent->isBrowser())
    {
     if($this->input->cookie('country')) {
    
                $countryId = $this->input->cookie('country');
    
            }else{
    
                redirect(base_url());
    
            }
    }
    

  2. HTTP 302 response code means that the URL of requested resource has been changed temporarily. Further changes in the URL might be made in the future. Therefore, this same URI should be used by the client in future requests.You can check this out to learn more

    Since you are actually redirecting Non-authenticated users (A category bots belong to), i think the error code is correct.

    What you can do however, is to add the page to robots.txt file so the page does not get indexed at all.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search