CodeIgniter Forums
base_url and form_open give different output url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: base_url and form_open give different output url (/showthread.php?tid=56114)



base_url and form_open give different output url - El Forum - 11-27-2012

[eluser]zarcel[/eluser]
Hello,
I have noticed that base_url('whatever') gives url without index.php for example: http://example.com/whatever

and

form_open('whatever'); gives url with index.php, example http://example.com/index.php/whatever


I believe it should be standardized.


base_url and form_open give different output url - El Forum - 11-27-2012

[eluser]PhilTem[/eluser]
It is standardized. If you remove the index_page option in your config.php config, then form_open() and base_url() will give the same result.

However, since form_open() basically acts as site_url() it must include index.php for sites that don't have .htaccess with mod-rewrite enabled Wink


base_url and form_open give different output url - El Forum - 11-27-2012

[eluser]Aken[/eluser]
form_open() uses site_url(), not base_url(). They are different functions for different purposes. Check the URL helper user guide page.