Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How do I view assets (images) via URL call? (default 1.7 install)
  • I've got a default 1.7 install and a single image file in my assets/img folder.  Simply trying to view the image by entering the url:  http://www.mydomain.com/assets/img/default.jpg

    This doesn't work and after reading through the documentation on assets, I don't quite understand what I need to do in order to make this visible.  Again, I'm just trying to make the image publicly accessible via a URL call.

    Thanks,
  • How did you install?

    In a standard installation your webservers' documentroot will point to the ./public folder, which will make  http://www.mydomain.com/assets/img/default.jpg work without problems.

    If you have installed everything inside the documentroot, you either have to get rid of the public directory (i.e. move everything in it one folder up, so it's in the docroot) or do some magic with your rewrite rules to insert the /public/ in the request.
  • Installed via command line OIL.  


     

    Nope, not here. We can't find that!


    The controller generating this page is found at APPPATH/classes/controller/welcome.php.

    This view is located at APPPATH/views/welcome/404.php.

    Page rendered in 0.0344s using 2.196mb of memory.

    FuelPHP is released under the MIT license.
    Version: 1.7.0

  • But the question was where you installed it. What does your document root pointing to? What happens if you go to http://www.mydomain.com ?
  • Installed at /var/www/sites/www.mydomain.com

    Structure looks like this:
    /var/www/sites/www.mydomain.com/public
    /var/www/sites/www.mydomain.com/fuel
    /var/www/sites/www.mydomain.com/docs
    /var/www/sites/www.mydomain.com/(misc composer stuff)

    Apache is pointed to:
    /var/www/sites/www.mydomain.com/public

    mod_rewrite is on

    Going to http://www.mydomain.com gives:

    Welcome!

    You have successfully installed the FuelPHP Framework.


    Maybe it's the mod_rewrite that's messing things up?  Maybe everything is routing through the welcome controller?




  • That looks like a completely standard installation, which should work fine. Did you apply any additional rewrite rules, other then the .htaccess supplied in the public folder, or modified those rules?

    If you disable rewriting, can you then access the asset? Are you sure it's not a rights issue (you get a 404 because Apache can't read the file)?

Howdy, Stranger!

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

In this Discussion