title: PHP cookie set to redirect, googlebot redirects too - how to stop this?
body: <p>When a user hits domain.com for the first time, a cookie is set and they are redirected to domain.com/welcome (which is basically the index but with like an introduction animation that will only show once).</p>
  
  <p>When a user visits the site a second time, it stays on domain.com and doesn't go to domain.com/welcome anymore because the cookie has been set already.</p>
  
  <p>Easy enough. To test it, go to <a href="http://lansana.me" rel="nofollow">http://lansana.me</a></p>
  
  <p>The problem is, I blocked /welcome in robots.txt to prevent duplicate pages on search results (because the / and /welcome pages have basically the same content, one is just more animated), but when I try to fetch as google in webmaster tools, it says it was redirected to the /welcome page (obviously). Is there any way I can tell Google not to listen to the code I have that redirects?</p>
  
  <p>Here is my controller in Laravel, setting the cookie and redirecting or staying on the home page (PHP):</p>
  
  <pre><code>    public function index() 
      {
          $cookie = 'oreos';
          $value = 'redirect'; 
          $expiration = time() + (10 * 365 * 24 * 60 * 60);
          $domain = '/';
  
          if (!isset($_COOKIE[$cookie])) {
              setcookie($cookie, $value, $expiration, $domain);
  
              $articles = ArticlesModel::latest()-&gt;orderBy('created_at', 'desc')-&gt;get(); 
  
              return redirect()-&gt;action('ArticlesController@welcome');
          } 
  
          $articles = ArticlesModel::latest()-&gt;orderBy('created_at', 'desc')-&gt;get();
  
          return view('pages.index', compact('articles'));
      }
  
      public function welcome() 
      {
          $articles = ArticlesModel::latest()-&gt;orderBy('created_at', 'desc')-&gt;get(); 
  
          return view('pages.welcome', compact('articles'));
      }
  </code></pre>
  
  <p>Here is the JavaScript that basically does different stuff based on the page (I'm not sure how important this script is to this question):</p>
  
  <pre><code>    // IGNORE THIS LINE
      if ($(location).attr('pathname') == '/resume') {
  
          .....
  
      // if current page is /
      } else if ($(location).attr('pathname') == '/') {
  
          .....
  
      // If current page is /welcome
      } else if ($(location).attr('pathname') == '/welcome') {
  
          .....
  
      }
  </code></pre>
  
  <p>If there's no way to tell googlebot to ignore the index and welcome method and just go to index, is there a better way to achieve what I'm doing that won't conflict with googlebot?</p>