Redirect not working with string as parameter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Redirect not working with string as parameter (/showthread.php?tid=43605) |
Redirect not working with string as parameter - El Forum - 07-18-2011 [eluser]Unknown[/eluser] My code looks like so Code: class Awesome extends CI_Controller when i key in "http://localhost/awesome_site/index.php/awesome/test_string" on my browser, it returns '404 Object Not Found'. Please help Redirect not working with string as parameter - El Forum - 07-18-2011 [eluser]davidbehler[/eluser] Are you sure it even does the redirect? What happens if you replace the redirect with Code: echo 123; Redirect not working with string as parameter - El Forum - 07-18-2011 [eluser]rogierb[/eluser] It looks like a relative redirect instead of an absolute redirect Code: redirect("awesome/test_pass_string/".$param); will probable do something like redirect to http://localhost/awesome_site/index.php/awesome/test_string/awesome/test_pass_string/{param} so try something like Code: redirect("/awesome/test_pass_string/".$param); Redirect not working with string as parameter - El Forum - 07-18-2011 [eluser]Unknown[/eluser] No luck. I've changed it to Code: redirect("/awesome/test_pass_string/".$param); and still 404. However, I've tried shortening the 404 url from Code: http://localhost/awesome_site/index.php/awesome/test_pass_string/GgkyUW3k0FfQUEYLumqVsQs/vQ2gtoigdsvRpOqFO+oUwIqBCsudaFBJew+FWSIBI6XnPP6sfwxo3rlb6p8TTQ== to Code: http://localhost/home_finance/index.php/site/test_pass_string/GgkyUW3k0FfQUEYLumqVsQs and it works. Does this mean I can't use (%) character in redirect? Or is there another way? I'm trying encrypt the value I'm sending since calling something Code: awesome/delete_something/2 (2 being the id to delete) will be more prone to abuse than Code: awesome/delete_something/GgkyUW3k0FfQUEYLumqVsQs Thanks. Redirect not working with string as parameter - El Forum - 07-18-2011 [eluser]rogierb[/eluser] I see what your trying to do but obfuscating is never good practice. I could easily write a script that tests every possible uri and delete things from your db. It might take weeks but still... You can still use Code: awesome/delete_something/2 But I would go with post data and test that post data instead of relying on and URL. For instance I use both: Code: awesome/delete_something/2 |