Search code examples
phpcodeigniterphp-7codeigniter-4

Why does CodeIgniter 4's anchor() utilize site_url() format (with indexPage) instead of base_url() (without indexPage)?


anchor() generates links with indexPage appended e.g. http://example.com/index.php/news/local/123. Wouldn't it be prettier (SEO-wise) to not have the indexPage? e.g. http://example.com/news/local/123 like base_url() does? What would be the downside(s) of doing so?

Is there an option to configure this?


Solution

  • In app\Config\App.php set

    public $indexPage = '';
    

    and your problem is solved.