Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJosh Naylor
19,341 PointsSite not working when uploaded to hosting
Everything works fine on localhost, but after uploading a site I made while following these videos, only the homepage loads and none of the images load.
I get 404 errors when trying to go to pages other than the homepage and in the console I am getting "Failed to load resource: the server responded with a status of 403 (Forbidden)" for all of the images on the page...
I have tried uncommenting the RewriteBase / in the htaccess file, but no luck. I even tried uploading Hampton's project files to a test directory on my server and the images load... so not sure what I am doing wrong as I am loading them the same way.
Here is a link to a demo http://andersen.demo.zylowebthings.com/
Any help would be greatly appreciated!
5 Answers
Ted Sumner
Courses Plus Student 17,967 PointsI am not sure why this is the way it is, but your link has a problem:
<img src="http://http://andersen.demo.zylowebthings.com/images/andersen-plumbing-logo.png" class="img-responsive center-block logo" alt="Andersen Plumbing Inc Serving Southeastern Wisconsin Since 1992">
You need to figure out why you have two html:// and get rid of one. If that fixes it, great. Otherwise we can troubleshoot more.
Ted Sumner
Courses Plus Student 17,967 PointsLooking at the issue more, you should not even have a http:// for your images. You should have a path to the img folder and the file name.
Josh Naylor
19,341 PointsThanks Ted! It worked for the logo, but for some reason that's the only image it worked on!
I also tried it on a few of my other .twig files. If you look at the html generated on the home page, the images in the slider won't show up, nor the image in the copy below.
I also tried changing the path for the image in the copy on the "Who we are" page and it still doesn't show, not even on my localhost version.
The path I changed the images to is like now this: src="images/image-file.jpg".
Also, I noticed in Hampton's files that he is using {{ siteUrl('/contact') }}, while I am using {{ urlFor('contact') }}. When I try changing it to siteUrl, I get a 404 when navigating to that page. Do I have Slim or Twig installed incorrectly or something?
Josh Naylor
19,341 PointsI think I found the answer! It seems that all of the images in the folder did not have the "Read" permission checked when it was uploaded to the hosting.
Ted Sumner
Courses Plus Student 17,967 PointsThe permissions error makes sense.
Ted Sumner
Courses Plus Student 17,967 PointsNot all your links work, however. The dishwasher is a 404 error.