Changing from default index.html page to login.html page

2,402 views
Skip to first unread message

Ruben Franco

unread,
May 2, 2016, 2:47:43 PM5/2/16
to Firebase Google Group
Hello,

I know firebase looks for the 'index.html' page in your directory and it sets that as the homepage for when users open the app url. However, my app is currently set in a way that I need users to load login.html first and after authentication go to the index.html. How can I redirect or change the default 'index.html' to 'login.html' without having to rename everything? Thanks.

Kato Richardson

unread,
May 2, 2016, 3:06:09 PM5/2/16
to Firebase Google Group

Ruben,

The rewrites section of the guide has an example nearly identical to this question.

Maybe fiddle with something like this?

"rewrites": [ {
  "source": "/index.html",
  "destination": "/login.html"
} ]

☼, Kato


On Mon, May 2, 2016 at 11:46 AM, Ruben Franco <ru...@ias1.com> wrote:
Hello,

I know firebase looks for the 'index.html' page in your directory and it sets that as the homepage for when users open the app url. However, my app is currently set in a way that I need users to load login.html first and after authentication go to the index.html. How can I redirect or change the default 'index.html' to 'login.html' without having to rename everything? Thanks.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2200cf80-2c05-4a01-afa3-fde6514b79eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Michael Bleigh

unread,
May 2, 2016, 3:11:36 PM5/2/16
to Firebase Google Group

Hey Ruben,

Firebase Hosting is static hosting, meaning we don’t serve different content based on app state. There are two approaches you can take for this:

  1. Build a single-page app style site that keeps both the logged out and logged in state in index.html and uses JavaScript to decide which to show.
  2. Use JavaScript to trigger a redirect if the auth state isn’t what you want. e.g. window.location = '/login.html';

Hope that helps.

-Michael

Reply all
Reply to author
Forward
0 new messages