When visiting facebook or twitter, you are presented with the login/signup screen. The URL does not contain a query string. Once you have logged in, you are presented with a feed and again a URL without a query string.
What would be the best way to achieve this with fuel?
Currently my _root_ is home/index. Controller_Home extends Controller_Auth which in the before function checks that the user is logged in, if not redirects to auth/index.
So the current end result is on first visting my app, the user sees http://fuelphp.com/auth/index and upon a successful login, sees http://fuelphp.com/. I would like to hide any segments from both screens.
I hope I have made sense here. I shouldn't be writing code on a Sunday night!
FuelPHP URL's never contain a query string.
Hiding segments isn't a good idea, since it would not allow bookmarking, and will make navigation extremely difficult (as you have to store somewhere what your next page is going to be).
Hi Harro,
Thanks for the reply. The problem I am having is that I want to set home/index as my _root_. This is a protected area requiring the user to be authenticated. As is pretty much most of the app. So all of my controllers extend Controller_Auth which performs the auth check and redirects to a login screen if not logged in. The problem I have with that is that the first screen a user will see if they are not already logged in is http://fuelphp.com/auth/index. I would prefer they don't see any segments at first visit so they can bookmark http://fuelphp.com/.
Then set your _root_ route to 'auth/index', and have your Controller_Auth redirect to "/" when no user is authenticated.
If you have a landing page for authenticated users, you can redirect to that from 'auth/index' when you have an authenticated user, so when a user goes to the root of your site, they will get the landing page, and not a login page.