Redirect issue

Website: trashdown.infinityfreeapp.com

When I access my webpage with this url, it displays the homepage, but it gives me error 403 Forbidden when I click on other parts of my page. My website works perfectly if add /Home.html to the end of the link. I tried putting in a redirect in .htaccess from trashdown.infinityfreeapp. com to trashdown.infinityfreeapp .com/Home.html, but it didn’t work. Also, there is supposed to be an image on the top, but it isn’t showing up. (There is a space in the middle of some of the links because it won’t let me put in more than one link.)

Hi and welcome to the forum! I can’t see your website directly by the URL without anything else; you have to put this on the .htaccess file on your htdocs folder:

DirectoryIndex Home.html

Also, two things from this article:

The htdocs folder is NOT visible in the URL

The base of your website is linked to a htdocs folder. This means that, by default, a file name on your account matches the path coming after the htdocs part.

So if you have a file with the path htdocs/about.html, the URL will be http://example.com/about.html and the file at htdocs/images/logo.png will have the URL http://example.com/images/logo.png.

In other words, the htdocs part should NOT be included in website URLs. Unless, of course, you create an additional folder with the name htdocs within your website’s htdocs folder (so htdocs/htdocs/photo.jpg).

Be aware of how URLs are evaluated

There are different ways to use URLs on a website.

A few ways to specify URLs are:

These can all be used successfully to refer to a particular file, but they all work slightly different. You should be aware of which method you are using and what the consequences are. This StackOverflow answer describes the differences very well.

3 Likes

I just did that. Now, it is the same issue covered in the first message.

Site works fine:

That’s because your CSS is incorrect:

      background-image: url('htdocs/images/trash\ at\ dw.jpg');

The topic covers this case:

Fixing the URL should result in the image displaying.

4 Likes

The links in the top menu don’t work for me, but this is caused by incorrect URLs in your code. For example, the FAQ link is configured to point to trashdown.infinityfreeapp.com/FAQ.html. But due to how browsers interpret URLs, browsers will complete this URL as http://trashdown.infinityfreeapp.com/trashdown.infinityfreeapp.com/FAQ.html, which is of course not correct (it should be http://trashdown.infinityfreeapp.com/FAQ.html).

The link does work if you use one of the following URLs instead:

  • FAQ.html
  • /FAQ.html
  • //trashdown.infinityfreeapp.com/FAQ.html
  • http://trashdown.infinityfreeapp.com/FAQ.html

Note that these URLs are identical for this case, but they will behave differently on different pages.

For more information about how you can write URLs and what it means, please see this post: html - Absolute vs relative URLs - Stack Overflow

5 Likes

Thank you guys for that, the 403 error has now gone away when I go to FAQ or Info, and the image is showing up on the home page. But, when I go to FAQ or Info, the header image doesn’t show up, even though it has the same file directory listed in the code of the home page.

In your code in the FAQ and Info pages you have this:

      background-image: url('images/trash\ at\ dw.JPG');

As compared to Home’s:

      background-image: url('images/trash\ at\ dw.jpg');

The difference may not appear at first, as it is a subtle one (I myself used a tool to find it). In the code for the FAQ and Info pages you have the .jpg extension of the images capitalized as .JPG, which is the cause of this issue.

This is also explained in the article linked above:

Replacing the .JPG with .jpg should help.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.