Welcome Guest, Not a member yet? Register   Sign In
Form Helper: form_open with NO "/index.php" in action attribute?
#1

Is there a supported method to to use the Form Helper's form_open method without it writing "/index.php" in the action attribute of the form tag short of manually writing the tag?

echo form_open('action') outputs:

     <form action="https://domain.tld/index.php/action" method="post" accept-charset="utf-8">

I would prefer echo form_open('action') to output:

     <form action="https://domain.tld/action" method="post" accept-charset="utf-8">

I am currently using the following workaround:

     echo str_replace('/index.php', '', form_open('action'));
Reply
#2

You will need to remove index.php from this setting (config/config.php)

PHP Code:
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = ''
Reply
#3

I am using CodeIgniter 4 and found the setting in \app\Config\App.php. Thanks for pointing me in the right direction.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB