Skip to content
Advertisement

How to redirect the user to another page after successfully signing in or signing up in HTML?

I’m looking to redirect the user to another page after successfully signing in or signing up in HTML and Firebase.

I have login.html and signup.html as well as home.html inside the home folder.

After successfully signing in or signing up, I need to redirect the user to home.html as well as prevent the user from returning to login.html or signup.html.

Advertisement

Answer

Redirect with JavaScript:

window.location = 'mysite';

Redirect in an HTML form:

<input type="submit" target="mysite" value="Sign in"/>

Redirect in an HTML meta:

<meta http-equiv="refresh" content="time; URL=new_url" />

Redirect in PHP:

<?php
header('Location: mysite');
exit;
?>   

Redirect in Firebase:

"hosting":{
   "/bar""for requests to""/foo""(but not""/foo/**"")""redirects":[
      {
         "source":"/foo",
         "destination":"/bar",
         "type":301
      }
   ]
}
Advertisement