My URI are redirect wrong - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: My URI are redirect wrong (/showthread.php?tid=62317) |
My URI are redirect wrong - ramon183 - 07-02-2015 Hi everyone! Well i don't speak english so much, so sorry about anything what i write wrong. Well, I have a problem when i need to get the segment 3 or anything other 4,5,6. This is my code which the action is register and when it's called, the action get the 3 param of the uri where is set in a link button <a href="House/register/{idhouse_via_template_engine}">Edit the House</a> which is the id of a house for example. Well, until then everything is okay . But when I click a link where I am coming back to the parent controller , for example , standing on the registration page with the third segment , all working ok and I click on a button to return to the management page : <a href = " House / index " > Back to the management </a> . My URL , rather than "House/index" is "House/register/House". I don't know what the url doesnt "reset", and symple redirect to the House/index PHP Code: <?php RE: My URI are redirect wrong - mwhitney - 07-06-2015 (07-02-2015, 02:02 PM)ramon183 Wrote: But when I click a link where I am coming back to the parent controller , for example , standing on the registration page with the third segment , all working ok and I click on a button to return to the management page : <a href = " House / index " > Back to the management </a> . I removed everything else in my quote from your original post, because I believe the rest is mostly irrelevant. The answer is that your link is relative (href="House/index"), so you're linking to House/register/House/index. You need to use a full URL, and the best way to do that is usually to use the site_url() function: PHP Code: <a href="<?php echo site_url('house/index'); ?>">Back to the management</a> RE: My URI are redirect wrong - CroNiX - 07-06-2015 Or just be sure to put a slash at the beginning of your href, so it resolves to site ROOT instead of relative to whatever the current url is: <a href="/house'); ?>">Back to the management</a> Will send you to http://yourhost.com/house Note you don't have to specify the index method, as that is default if no method is present in the request. |