CodeIgniter Forums

Full Version: Best way to remove the public/index.php in local testing environment
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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 = '';
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