Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Can't access assets (redirecting to controller)
  • I have this strange error in FuelPHP - I can not access asset files. When I type URL like this:



    http://localhost/assets/js/jquery.js


    I am redirected to root controller (as defined as _root_) in config/routes.php. It is very strange, I cannot access any assets (css, js, img). It has probably nothing to do neither with .htaccess nor with web.config files because this error remain even after these files are deleted and I have not modified them since install.



    For debug purpose I even created controller with name Assets to see if I can route to js action by calling localhost/assets/js
    but it is not working. Assets controller is ignored and root controller
    is executed instead. It is very strange because other controllers are
    working as expected.



    I run php in cli with document root set to [project_folder]/public. I can only load external assets for now but I need help so I can include my own stylesheet and scripts...



    Can you see the problem or at least help me with debug? I'm clueless now...

  • Files (any files) are fetched by the webserver, PHP and Fuel don't play a part in that process.

    So if you don't have any rewrites in place (that would redirect requests to Fuel), not serving assets is a webserver issue. I assume you have checked the webserver logs? Any errors in there?

    The most obvious cause is a rights issue, if the webserver user doesn't have read access on the assets, it would be able to load them.
  • There is no error in error log after assets are accessed...
    And strange thing is, that request is processed by FuelPHP controller instead of serving file...
  • Hello Grepy !
    I think that you try to load assets in your view, I'm right ?
    Do you are using Asset class and static methods to do this ?
    What controller is called to process the request (file name and class name)?
  • Hello, I still don't know what was the problem, but I changed php running method from cli to apache and now it works.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion