CodeIgniter Training 3rd part: remove index.php from URLs
Created by Eric Murillo on 2019-06-13
4z.com
Table of Contents
We continue with our guide on the basic concepts of CodeIgniter, in this training, we will see how to remove 'index.php' from the URL of our website. Before continuing, make sure you have completed and understood the previous training.
For this, we will need to create a .htaccess file and place it in the root of our website (next to 'index.php'). In this file we will write this:
This file does the following: first check if Apache has the module 'mod_rewrite', if so, start it on line 2, then set two conditions, if the requested route does not refer to any file or server folder, then the penultimate line of the file is executed, where the address is rewritten and 'index.php' is added to the beginning. For this to work it is necessary to put the option 'index_page' of the configuration file 'config.php' in white, and make sure that Apache has the module 'mod_rewrite'.
You must provide a screenshot of the new URL of the web without index.php
https://docs.switzernet.com/3/public/190611-CodeIgniter1/
https://docs.switzernet.com/3/public/190612-CodeIgniter2/
https://docs.switzernet.com/3/public/190614-CodeIgniter4/
https://docs.switzernet.com/3/public/190615-CodeIgniter5/
https://www.apachefriends.org/index.html
* * *
© 4z.com