How to "fix" .htaccess

F3 | Hostgator says they have fixed all links but I need to fix .htaccess. I went to “Publish” and did an edit on my .htaccess and saved. Then did a test and got a thumbs up. Site now opens but no images show up. See screenshot upload…

might want to show us the .htaccess file you have now so people can suggest changes

2 Likes

Yes, absolutely. A bit dumb on my part. Here it is…

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

There’s nothing in there that should cause images not to load.

When did this start happening? What changed when it started? Is this a new site or an existing site you updated? Have you republished all files to make sure everything uploaded correctly?

Can you post the link to the live site with the issues?

1 Like

Did you do a repulish all? And what is the URL you are testing?

1 Like

New site. Finally had help from Hostgator to ensure files in proper locations, etc. I’ve been testing it on my neilkosterman.com site, and there it works fine, so it would seem to have something to do with my uploading to jzmedicalsystems.com. I’ve republished numerous times, including adding a letter, uploading to see if it worked (it does to NK.com, but not to Jz.com). I will post the link, as soon as I have a break from my commitments. Thanks to you and to Fuellemann for taking a look.

Here’s the website that has had review by Hostgator, who pointed out some issue with the .htaccess file; they did not elaborate…

https://jzmedicalsystems.com

Here’s the project file in case anyone wants to take a look at it…

All of the images are showing a 404 file not found error. I would login with an FTP client or the file manager in Hostgator’s control panel and check if the files are actually on the server. They are loading from the “files” subfolder of your root web folder.

Thanks. I’ll go look again to be sure what you are seeing is what the Hostgator tech said, when he said it was OK and that the problem in his opinion was the .htaccess file. With all of my republishing since then, it remains possible that I caused some changes, since he passed it back to me. Thanks for your time to review. I’ll advise once I have an assessment.

Hi @NeilMike,

At this point, the advice from Hostgator seems odd to us here. But there might be something that the Hostgater rep knows that we don’t. Perhaps you’ve added something to your htaccess that blocks the images from being accessible.

So, I’d approach this with a two-step plan:

  1. Open your project file in RapidWeaver and click File > Re-publish all files
    This will force RW to upload everything, including the image files

  2. Check if this helped. If so: you’re now done.

  3. If the images are still 404-ing, do this: in RW, go to the Publishing tab in your project file:

    Capto_Capture 2023-05-04_08-23-44_am

  4. Click on your publishing method en then on the button Edit .htaccess file

  5. Paste what you copied into a reply in this topic

Cheers,
Erwin

Thanks, Erwin. I’ve actually done both of those recommends multiple times with the last time being just before I submitted my last effort here. In any event I will go through the steps again, especially ensuring that all the files are landing in the right place with my uploads. If not working, I think it is time to head back to Hostgator Help. Thanks again for taking the time and effort to help out.

Neil

Hi Erwin. I’ve been a bit busy, but I’ve worked through a number of iterations on my own and via the Hostgator tech support folks. Their last message to me yesterday was to go back to my “web developer” with my remaining issues, i.e., they believe everything they can control on their platform is OK. They are saying that my images have not/ are not on their platform. I’ve uploaded both using the “Publishing” method intrinsic to RW but also using FileZilla, where I can look at the Hostgator platform.

Here are the things, I’ve experienced since the last time I posted on this forum…

… I updated the URL of my site to JustinZdeb.com
… I did all the things you recommended, several times
… I just did another Edit .htaccess, and here is the current file…

php – BEGIN cPanel-generated handler, do not edit

Set the “ea-php73” package as the default “PHP” programming language.

AddHandler application/x-httpd-ea-php73___lsphp .php .php7 .phtml # php -- END cPanel-generated handler, do not edit

I am also posting my latest project file, which should be consistent with what is on Hostgator.

Neil

Oops, any ideas or suggestions about what to try next greatly appreciated.

Hi Neil,

Those lines added to htaccess simply set the php version. Possibly they get added by CPanel when you change the PHP version from the settings. They shouldn’t cause the images 404-ing.

I published your project file to my staging server (Site Styles) and it works fine there, with all the images uploading.

I’ll look into it some more later today.

Cheers,
Erwin

1 Like

Received and noted. Thanks.

Hi Erwin. Any additional analyses for me?

Thanks.

Neil

Hi @NeilMike,

Yes, sorry - I wasn’t able to look into it as soon as I figured I should be able to.

What I noticed when I published your site on my server, is that much more is missing on your server than simply the images. The CSS doesn’t load either, as the CSS files are also 404-ing.

The only conclusion I’ve come to, is that the files folder is simply not there. Both RapidWeaver and Foundry store their files (like images and CSS) in that folder.

It’s pretty much the only thing I’m unable to test (as I don’t have access to your server directly) and I wasn’t able to reproduce the problem in any other way.

Try this:

  1. Publish the project to a folder on your mac using the “Local Folder” function in RapidWeaver
  2. Dive into the folder and check if the files folder is there:
  3. Now log into your webserver using an FTP client
  4. Navigate to the folder that holds your website (usually public_html)
  5. Check if the files folder is there. My guess is it isn’t.

Last, copy the files folder from your locally published project to the root folder on your webserver. Check your published website - it should now load correctly.

Check back here with the results - as even if this is a quick fix, we still haven’t found the cause.

Cheers,
Erwin

Thanks. I’ll give that a try. Related, the Hostgator Team had made the same observation, when they felt that could not help me any further. As a result, I tried moving the Files Folder on their sever via FileZilla without success.

I also wonder why the same problem seems to occur, whether I upload using the RW function or whether I upload via FileZilla?

I’ll let you know what happens once I give it a go.

Thanks.

Hi @NeilMike,

That’s really odd…

Basically, you’re saying that the files folder disappears after you upload it.

Could you check if the folder is perhaps hidden? To do so, follow the steps in **this tutorial**for Hostgator’s File Manager.

EDIT: *I’m really scratching my head on this one. In theory, it’s possible to make a folder inaccessible through commands in the htaccess file, but the htaccess file that you posted doesn’t contain anything like that. *

*Other than the htaccess file, folder and files on the server have permissions that you can set (similar to how macOS does things). *

*In theory, you can hide files using permissions, but most (/all?) web server packages (Apache, Nginx etc.) won’t allow you that kind of access to files or folders remotely. They restrict you to set read/write and execute, even if the OS that’s running on the server offers much more settable permissions. *

But even if you or the hoster accidentally set a folder to hidden somehow, the folder should still be accessible if navigated to directly (like the htaccess file is accessible even though it’s hidden).

We can be sure of a couple of things:

1. the files folder does get uploaded. Both you and I have uploaded the project to a different server and everything works fine then
2. it’s not the htaccess file - the folder appears to actually not be there when you look at the folder structure with an FTP client

Cheers,
Erwin

Hi Erwin. Back again. So, you’ve provided two guidance responses, since I last tried anything. In your first one you guide me to “Publish the project to a folder on your mac using the “Local Folder” function in RapidWeaver.” I cannot find any command in RW allowing me to do that. Having said that, I jumped to your second guidance info, as I guessed it might supersede this earlier one. I should probably still learn how to do what you’ve suggested here. When I use FileZilla (FTP client), I source it from my desktop directly using the RW saved file on my desktop.
–––––––––––––––––––––
Regarding your second guidance, I’m attaching a collection of screenshots number from 1-4. This follows the structure of my files on Hostgator with 1 being my “home.” 2 is my public_html showing all of my subdomains, some of which are live and some are not. 3 shows what is in my public-html; note that I have two indexes: html and php. I’ve been told in th past by Hostgator support that that should not be, and in the past I’ve deleted the index.html as a result of their feedback. 4 shows what is inside of my FilesFolder with the latest dates at the time. It looks to me like this could contain all of the files from all of my subdomains, but I’ve not tried to suss that out yet.

As always, I will appreciate any guidance your expertise may provide. Thanks.