Welcome Guest, Not a member yet? Register   Sign In
Completely remove controller and function name form URL
#1

[eluser]albertleao[/eluser]
Hello everyone. First time posting, I absolutely love codeigniter! Smile

Anyways I had a question.

I currently have a website with a login screen which then redirects to an authenticated user homepage.

So I have a function in my login screen controller that redirects to the authenticated user homepage if he is already logged in. What I want is for the URL to continue being the same. Is there anyway I can do this?

For example:

Login page: www.mywebsite.com/landing

Routes:
$route['default_controller'] = "landing";
$route['landing'] = '/';

Url displayed: www.mywebsite.com
_________________________

Authenticated user page: www.mywebsite.com/home

Url I want to display: www.mywebsite.com


Is this possible?
#2

[eluser]Komp[/eluser]
tried using post data?
I'm new to this too, just have some general programming knowledge...
#3

[eluser]albertleao[/eluser]
What exactly do you mean as post data?

I wouldn't feel safe allowing post data allow for entry to the authenticated homepage as I know I should never trust any data that could possibly be manipulated by the user. But you did just give me an idea. If you the user is logged in, I should just fire up another view in the landing controller rather than redirecting to a whole new controller. I guess that could work.

I don't know if there is a security issue with that, but I don't see why it shouldn't work.
#4

[eluser]Komp[/eluser]
then just give it a try Wink

I meant that you can send some data that identifies in the index page what you are willing to do... of course, this data could possibly be manipulated, thus you have to check it before using it...

maybe this is just not possible in your case, I might get you wrong, sorry in that case...
#5

[eluser]albertleao[/eluser]
I will give it a shot. Will require some coding since my index function for my authenticated user controller calls alot of functions within that controller and I would have to transfer everything to the landing controller.

I will give it a shot though Komp. Ty for your input. If anyone else has any other thoughts, I am grateful.
#6

[eluser]Komp[/eluser]
by the way... have you tried using routing...? putting like ".com/signin" where "signin" is just a route rull...? So no one can actually know what controller are you using... just saying...




Theme © iAndrew 2016 - Forum software by © MyBB