title: Redirect from a login page
body: <p>I am building an intranet-like website for my high school students to use and I would like them to login using google sign-in because they all have google accounts. I have successfully integrated google sign-in using Google's instructions.</p>
  
  <p>When a new user visits the first page (the login page) of my site and logs in, I would like them to be automatically redirected to the second page. I have researched this on SO and elsewhere but not found anything yet. How could I do this?</p>
  
  <p>Also, if a user tries to access any page other than the first page without having first logged in, how can I redirect them to the first page?</p>
  
  <p>My website address and code is below. Let me know if you need any more information. Thanks!</p>
  
  <p>First page: <a href="http://davidstarshaw.atwebpages.com/test/index.php" rel="nofollow">http://davidstarshaw.atwebpages.com/test/index.php</a></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
      &lt;title&gt;Test login page&lt;/title&gt;
      &lt;meta name="google-signin-client_id" content="795531022003-rdb02epf7o0qpr5p83326icrseh82gqa.apps.googleusercontent.com"&gt; &lt;!--My google sign-in client ID--&gt;
      &lt;script src="https://apis.google.com/js/platform.js" async defer&lt;/script&gt; &lt;!--Google platform library. Needed for sign-in--&gt;
      &lt;script src="script.js" async defer&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;p&gt;This is the first page.&lt;/p&gt;
      &lt;div class="g-signin2" data-onsuccess="onSignIn"&gt;&lt;/div&gt; &lt;!--This code is straight from google--&gt;
      &lt;a href="#" onclick="signOut();"&gt;Sign out&lt;/a&gt;&lt;br&gt;
      &lt;a href=home.php&gt;Manually go to the second page&lt;/a&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Second page: <a href="http://davidstarshaw.atwebpages.com/test/home.php" rel="nofollow">http://davidstarshaw.atwebpages.com/test/home.php</a></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
      &lt;title&gt;Test home page&lt;/title&gt;
      &lt;meta name="google-signin-client_id" content="795531022003-rdb02epf7o0qpr5p83326icrseh82gqa.apps.googleusercontent.com"&gt; &lt;!--My google sign-in client ID--&gt;
      &lt;script src="https://apis.google.com/js/platform.js" async defer&gt;&lt;/script&gt; &lt;!--Google platform library. Needed for sign-in--&gt;
      &lt;script src="script.js" async defer&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;p&gt;This is the second page.&lt;/p&gt;
      &lt;div class="g-signin2" data-onsuccess="onSignIn"&gt;&lt;/div&gt; &lt;!--This code is straight from google--&gt;
      &lt;a href="#" onclick="signOut();"&gt;Sign out&lt;/a&gt;&lt;br&gt;
      &lt;a href=index.php&gt;Manually go back to the first page&lt;/a&gt;
  </code></pre>
  
  <p></p>