Why does Codeigniter understand a route as a directory and break links?

Asked

Viewed 184 times

0

I set up a CI system that uses template schema, with header, navmenu, template (component) and footer.

I use the Foundation for styling.

The problem is this: when accessing a simple route, such as home, I have no errors, but when accessing a route as user/new the page loses the reference, because the links to css, js and images, which are with relative link, are pointing to a user/ subdirectory because the system thinks it is inside this directory, but it does not exist, it is just a controller.

This does not happen with standard (index) controller methods, only when I try to access another method via the controller/method combination in the url.

Someone knows this mistake and how to fix it?

1 answer

0

Are you using the url helper? If so, you are also using base_url(); if not, the base_url it generates all the way of your project, needing only that you precisely list the folder and the name the file you want to access.

And you removed index.php by htaccess?

  • Yes, the . htaccess is configured. I did a test with base_url() and it fixes, but what I don’t understand is why the sitema understands the path as directory.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.