url duplication |
[eluser]Unknown[/eluser]
I have searched the forum and have not come across this. First, let me say I am new to CI, so bear with my newbie questions. I am roughing out the site navigation for my new site and have a menu of links Code: <ul> This view is created in my Home index() function and operates fine. However, once I have moved back and forth a few times, my url's start to take me to Code: http://mysite.com/index.php/home/profile/home/profile <-- Note the duplication instead of the normal Code: http://mysite.com/index.php/home/profile They look fine when using "view source", but you can see the different URL that is created in the status bar when you hover over the link, and it takes me to a 404 page (of course). I can't tell what is different. Some clarifying info. Upon successful login, I do Code: header('Location http://mysite.com/home/index.php'); if the login fails, I link to "home/login_failed" where it is Code: login_failed() Any ideas why going to the exact same page via a direct link differs from going to the same page via a redirect or via a subroutine call? (I think the problem is with the subroutine version). Greg
[eluser]pistolPete[/eluser]
You should use absolute urls, have a look at the extra / at the beginning of the url: Code: <ul> Alternatively you could use the url helper: user_guide/helpers/url_helper.html
[eluser]kulldox[/eluser]
see this http://ellislab.com/forums/viewthread/125735/ thread how I solved it.
[eluser]n0xie[/eluser]
You can use the url helper which gives you access to deze 2 functions: Code: base_url() These should solve all your problems.
[eluser]Aken[/eluser]
pistolPete's solution is 100% correct, no need to elaborate. |
Welcome Guest, Not a member yet? Register Sign In |