CodeIgniter Forums
Renaming index.php problem - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: Renaming index.php problem (/showthread.php?tid=85840)

Renaming index.php problem - dgvirtual - 12-10-2022

I run into a problem of renaming index.php to api.php, for though the app/Config.php file comment suggests that it can be renamed
PHP Code:
    * --------------------------------------------------------------------------
    Index File
* --------------------------------------------------------------------------
    Typically this will be your index.php fileunless 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.
    * @var string
    public $indexPage = '
, changing the $indexPave variable to api.php and renaming the index.php file actually resulted in an error: 

Quote:Warning: require_once(/home/myuser/dev/mywebsite/backend/public/index.php): failed to open stream: No such file or directory in /home/myuser/dev/mywebsite/backend/vendor/codeigniter4/framework/system/Commands/Server/rewrite.php on line 46

Fatal error: require_once(): Failed opening required '/home/myuser/dev/mywebsite/backend/public/index.php' (include_path='.:/opt/lampp/lib/php') in /home/myuser/dev/mywebsite/backend/vendor/codeigniter4/framework/system/Commands/Server/rewrite.php on line 46
Well, to fix it I had to modify the system/Commands/Server/rewrite.php file by replacing the two occurences of index.php there with api.php; it works now, but changin CI core files is the wrong way to do things...

Should I consider the fact that index.php is hardcoded a bug and report it? Or am I missing some setting?

RE: Renaming index.php problem - kenjis - 12-10-2022

It might be a bug, but we won't fix it.

Your fix is no problem, because the file is used only when you use `spark serve`.
If you don't want it, please use Apache or Nginx instead of `spark serve`.