CodeIgniter Forums
Best way to remove the public/index.php in local testing environment - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Best way to remove the public/index.php in local testing environment (/showthread.php?tid=79352)



Best way to remove the public/index.php in local testing environment - samikos - 06-02-2021

Some have suggested copying the index.php and .htaccess file from the public directory. But I'd not like to mess around file protection and opt for a different way to remove the public/index.php from the URL. What is the best way to do this?


RE: Best way to remove the public/index.php in local testing environment - captain-sensible - 06-06-2021

not sure i fully understand you but for local development say using apache(for CI4) and perhaps virtualhost approach then for instance in virtualhost entry would look like this:

<Directory "/srv/http/webappDirectoryname/public">
.........
''''''''''
</Directory>



So when /etc/hosts is done , mod rewrite is enabled in httpd.conf etc etc then when you enter domain name in adress bar of browser , its set up so that the web root is pointed to public directory of Ci4


So the only thing to do remove /index.php from url is to edit app/Config/App.php and make it look like this;


/*
|--------------------------------------------------------------------------
| 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.
|
*/
public $indexPage = '';


RE: Best way to remove the public/index.php in local testing environment - paliz - 06-06-2021

Set indexphp to null kn app config

and dont try move change htaccess in public/ htaccess or move public/index. Php oky its not secure
Hackers can red env file and other thing you have to create htaccess for level upper root ducemnt to when you try come
App redirect you to public/ index. Ohp



Thtas its better