Hurry! Save upto 90% | April 2024 X

How to use Routing in the PHP CodeIgniter framework?


Please follow the steps:

  1. Sometimes in your code, the function names include the character underscore. And, thus it becomes a part of the URL.
  2. But an underscore in URL, isn't so good for search engine optimization.
  3. It is therefore advisable, to replace the underscores with hyphens.
  4. Thankfully, this can be done so easily in CodeIgniter.
  5. Click open the routes.php file, inside the config folder.
  6. Scroll down the page, and type TRUE.
  7. Now, access the same page with hyphens.
  8. It works.
  9. All files with underscores have been replaced by hyphens.
  10. You can replace complete words in this way.
  11. Open the routes.php file again.
  12. Since the URL contains a query string variable, you need to type some extra codes, after the filename.
  13. Now check.
  14. The same page is resolved by a different filename.
  15. This way you can change the display URL of any webpage.
  16. This enhances the basic security level of your website, by hiding the actual controller names.