Php – Redirecting a Url in codeIgniter to a root folder


I have a folder structure like this in Code igniter : –

- www
    - CI
      - application
        - config
          - config.php
      - adminfolder
      - system
      - css
      - jss

And now i want to redirect the Url when the user goes to the controller : formhandler and action: login of url, http://localhost/CI/formhandler/login to this : http://localhost/CI/adminfolder How to do this ? Thanks in advance .

Best Solution

This can be done by using URL Helper of CodeIgniter.

This helper library should br loaded using the following code:


To redirect you just need to call function as follow. Put this code inside your login method.


Reference code: