Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] how to remove "****.php" from the URL when redirecting?
#1

[eluser]takasia[/eluser]
Hi there!

I just started playing with CodeIgniter yesterday so I am a total newbie - I want to learn to use it and use it for my next development project.

Now, it looks really easy, nice and smart - but I have one problem I don't know how to manage... :-(

I have a log in screen -> you log in and if the ID/PASS is fine, you are redirected to "http://localhost/my.php/all/home"

I have the .htaccess working, and if I remove manually the "my.php/" from the URL, it's still showing right pare BUT - what I really want, is this:

log in success -> you are redirected to "http://localhost/all/home"
instead of "http://localhost/my.php/all/home"

Is this possible?

To redirect I used this code:
redirect($this->session->userdata('type').'/home');

Maybe there is another way - instead of redirecting that would do in this case?

Thanks for any help - I just read tones of manuals and Wiki pages but found only solutions with .htaccess - and this seems not to work for me...
#2

[eluser]takasia[/eluser]
Self-solved :-)

I'm sorry for bothering - but here is the answer, maybe it would be useful for someone else :-)

Instead of redirecting like I posted first:
redirect($this->session->userdata('type').'/home');

I just added base_url() to the path, and it works :-)

It now looks like this:

redirect(base_url().$this->session->userdata('type').'/home');

With the .htaccess working, you get:
http://localhost/all.home
after logging in, which calls localhost/my.php/all/home

Kasia




Theme © iAndrew 2016 - Forum software by © MyBB