Codeigniter redirect with base_url
Posted
by Obay
on Stack Overflow
See other posts from Stack Overflow
or by Obay
Published on 2010-06-12T22:27:04Z
Indexed on
2010/06/12
22:32 UTC
Read the original article
Hit count: 374
I noticed that anchor('controller/method') produces a different result than a mere <a href="controller/method"> in that anchor() adds the base_url:
anchor():
<a href="http://localhost/dts/controller/method">View Timesheet</a>
<a>:
<a href="controller/method">View Timesheet</a>
How do I achieve this same effect (anchor) in my controller? That is, adding the base_url in my redirects?
I'm asking because I have a form that calls another method method2, which has a redirect('controller/method'). But it redirects incorrectly to controller/controller/method, then if the form is submitted again, redirects to controller/controller/controller/method and so on.
That's why I'd like to know how to redirect to controller/method with the base_url pre-prended to it. redirect( base_url() . 'controller/method' ) doesn't work.
Any ideas?
© Stack Overflow or respective owner