CodeIgniter Training 3rd part: remove index.php from URLs

Created by Eric Murillo on 2019-06-13

4z.com

 

 

Table of Contents

Presentation. 1

Remove index.php from URLs. 1

Validation. 1

Bibliography. 1

End of document. 1

 

Presentation

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.

Remove index.php from URLs

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'.

Validation

You must provide a screenshot of the new URL of the web without index.php

Bibliography

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.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-debian9

https://www.apachefriends.org/index.html

https://www.codeigniter.com/

 

End of document

 

 

*   *   *

© 4z.com