Verify Your Home Directories

I don’t do a lot of technical blog posts these days, so I thought it was a good time to go the technical route after a process I went through last week. Of course, I’m going to start with a story that goes back over 10 years ago. I remember it well because I’ve written about it and saved the file just for this purpose (tip: if you do anything technical or something you think you might need to look back on, save it in a text file or somewhere else, and give it a name that you’ll hopefully be able to find later on down the line).

by Niels Hiedenreich via Flickr

Years ago I was creating a blog for one of my web clients; I’d already created her website. A quick down and dirty for informational purposes is that what you do is go into your host and create an area for your blog software to be uploaded to. If you’re domain is going to be your blog then you’re pretty much set. However, if you’re going to add your blog to your existing domain, then you need to create a subdirectory within it. These days it’s not recommended, and I’ll tell you why later on.

I went into her host account, which back then was called 1&1 and now goes by IONOS (which I still use), and created the subdirectory. When you do this, you have to make sure you’re creating the subdirectory within the original domain as opposed to creating a subdomain outside of the main domain. I’m not going to try explaining that because it looks and sounds stupid no matter how I might try to clarify it. lol

After 10 minutes I went to check and the new folder was there, all set for me to upload the software. I did all of that, using WordPress of course, and it took just over 5 minutes. I had already prepared myself by going into MySQL and creating a database for the blog, so I opened the wp.config.sample.php file (fake file created as only a test file, then changed to…) and put the proper information into it, then uploaded it as wp.config.php, as you’re supposed to do.

All seemed to go fine. I went to the link for the blog, created a password, signed in and all looked pretty good; normal, I’ll say. I had gone searching for a few different templates for my client to select from, but I chose one to start with because I knew she liked colors.

Everything looked pretty good, but I noticed when I was looking at one of the themes I was considering that there was an error code that kept showing up. I had planned on sending her an email telling her about the blog, but decided to wait until the next morning.

The next morning comes and I try to find her blog; it’s not there. Neither is her website; ouch! Actually, her website was now showing up as a skeleton of what her blog would look like without any pattern or background; this wasn’t good.

I thought that maybe I had done something wrong to the .htaccess file, so I went in and deleted that; nothing happened. I reloaded all the blog software; nothing. As a matter of fact, I was now getting one of those Error 500 messages; things seemed to be getting worse.

I decided to delete all the blog files and start again. When that was completed I tried to go to the main website and now I was getting Error 403. I wasn’t quite sure about that one so I did what I should have done in the first place. I went to the host site and then to their FAQ. I looked up Error 403 and it said that meant the site was being directed somewhere that didn’t exist as the main directory.

Suddenly it all made sense. I went into the domain settings and I had made a mistake. I’d created the new directory, but inadvertently told the site that the new directory would be the new main directory instead of a subdirectory of the one already existing. Ugh! Had I checked the stupid FAQ first I’d have saved myself hour’s worth of headaches. I went back into the domain area, told it that the original directory was the main directory, waited 5 minutes, and the website was back, proud as anything.

After that I reloaded all the blog software, et al, and the new blog was back in service, looking great, and the original website was back as well; whew!

Sorry; I needed a break 😀

So… with that behind me, you’d think I might have had no problems with a few weeks ago I got an email from IONOS saying that the PHP version I was using had expired on 12/31/22, and that I had to upgrade to one of the newer versions. I knew how to do it, so I waited a week because I had other things to get to, then logged into my IONOS account and went to the PHP link. BTW, since it’s more complicated than I’m in the mood for, here’s a link to tell you what PHP is, and why it’s important.

Anyway, I was on PHP version 7.4, and I could either switch to PHP version 8.0 or PHP version 8.1. Version 8.0 would expire at the end of 2023, whereas 8.1 expires at the end of 8.1. That seemed like the smarter way to go, so I picked one of my sites and selected 8.1.

That broke my site! In essence, all I had were error messages, and I couldn’t get back to the site. I tried a few things, none worked, so I went back in and reversed back to 7.4. All was good again, but I was frustrated. I decided to do what I usually do; research via Google. There were a few recommended tips, but only one of them worked for the site I’d started with, that being to inactivate all the plugins, then try one of the newer versions and see what I got. It worked, and I tested the plugins a few at a time until I found one that was messing things up, and I deleted it and found something newer; yay!

Now I was on my way… or do I thought. none of my other blogs, including this one, would work after I tried 8.0 (I wasn’t confident enough to jump to 8.1). However, my two actual websites worked, and since I coded both of those myself I felt at least somewhat proud. 🙂 But that wasn’t going to get it done.

I waited until the next morning, then called IONOS customer support. I got this lady on the line and for the next 90 minutes she did her magic, though nothing like pulling a rabbit out of a hat. She was able to fix all the blogs… except this one; ugh! She said that there was a problem with the theme I was using, and I told her it was a WordPress theme, fourteen, but she said they couldn’t do anything with themes. So this one went back to 7.4 and I had to figure it out on my own.

To say I was frustrated is understating my exasperation. I kept getting the same error messages, and I had no idea what they were trying to tell me. Thus, I headed back to my favorite teacher, Google. I pasted in one of the error messages and I eventually came across a site (the 7th btw) that said something about opening up one of the files by downloading it to my computer via a FTP/SFTP program and seeing if I could figure out where the problem might be.

There were 5 files showing errors, so I downloaded all 5 of them. Two of them I opened, and they had the exact same files inside. Then it hit me that 4 of the files were in the same WP directory, and I thought to open up the file that was in a different directory, which was wp.config.php. In some themes there’s more than one of those, so you have to make sure to go to the directory that the error message is indicating and download that one.

That file is one that anyone who sets up a new blog has to add certain information to such as domain name, password, etc. I immediately saw that particular file was corrupted, and I knew some stuff had to be removed. But I wasn’t immediately sure how to re-code everything.

The it hit me; the file came from the original theme of this blog, and it’s the same theme I use on one of my other blogs, the one that actually worked the first time. I went back into the SFTP program, downloaded that same file from the other blog (into a different folder on my computer so I wouldn’t mess anything up), and opened it up on my computer (using the Notepad text program is the easiest way to go). I could see what was in the new file looked clean, and all the mess and other stuff that the file for this blog contained. So… except for a few specific things, like what I mentioned earlier, I removed all the extra code and added a few things that were in the newer file.

I uploaded it back to the correct directory, tested it to see if it was working correctly, then went back to IONOS and tested 8.0; all worked fine. Then I went to 8.1; yahoo! 🙂

I’m not going to say this is easy for everyone to do, and I’m certainly not recommending it. I am saying that if you have the confidence to give it a shot, make sure you can find that same theme file somewhere else because you start messing with it.

I’m not quite done though. I mentioned earlier that it’s not recommended to add a blog to a subdirectory of a blog. That’s what caused the problem with the two blogs that were subdomains of actual websites. Instead, they should have been put into their own subdirectory, which would have made fixing them much easier… at least that’s the the lady on the phone told me. 🙂

Now you know the rest of the story; I hope it helps some of you who might run into this problem.
 

Leave a Reply

Your email address will not be published. Required fields are marked *