Search code examples
phpcodeignitercodeigniter-urlcodeigniter-routing

URL base changing after using any controller with parameters


i'm having an problem with the URL of Codeigniter. When i use one controller with parameter, example: localhost/ci/products/news (where localhost/ci is the url base), after i click in any element <a />, example: <a href="home"/> Codeigniter redirects for localhost/ci/products/home and no for localhost/ci/home.

Anyone know why this happens?


Solution

  • You must use a base_url for links. Right now your anchor has a relative path in the href="home", you should have full path in your links, when u use mod_rewrite for nice urls.

    like

     <a href="https://your.server/ci/home">Home </a>