How to Fix My Website Is Downloading a File After Switching Web Hosting and Some Images on My Blog Are Missing

Have a Look at My Solutions for These Problems After Changing Your Web Hosting Provider: My Website Is Downloading index.php Instead of Loading My Website and Some Photos Are Missing from My Blog After I Switched from Shared Hosting to Unmanaged VPS with CyberPanel.

Why my blog is downloading a file after I change my hosting

Why when I try to access my website, a file is downloaded and there are missing image errors?

The other day, I finally managed to transfer my website from shared hosting to a VPS in the United States, but the headaches came afterwards. I had two issues after moving the site: when I reactivated the protection/CDN (Cloudflare), instead of loading the website when I tried to access the blog, Google Chrome browser downloaded a file, specifically index.php.

The second error was that there were many missing images on the site, so I had to go through each blog article and check which image was missing. But… let me first tell you about how the website transfer went.

The first time I attempted to move the backup archive with files from public_html using CyberPanel’s file manager, I couldn’t do it because CyberPanel seems to have a bug when transferring large files with its options. So, I successfully uploaded the zip file to the server using FTP (File Transfer Protocol) and FileZilla, after configuring both the server and the client side.

After uploading the files, I also uploaded the database, and then I made sure to configure wp-config.php to update the new database details, because if you don’t do this, the database won’t load and will throw an error. Then, I manually edited in Cloudflare’s DNS zone the IP address of the new web hosting, and within a few seconds, I was already at the new hosting.

The next step was to issue a new Let’s Encrypt SSL certificate for cik.ro because if the DNS is not pointed to your website when you add a new site in CyberPanel, it will create a basic SSL certificate that is not recognized by browsers. If you don’t have a valid certificate, you will receive an error message stating that the site is not secure when you enter on it. I issued the certificate, and within a few minutes, the blog loaded without any other issues.

The entire transfer process took about half an hour, and this time I didn’t encounter any errors like in the past. Everything went smoothly with the transfer, but the problems came afterwards.

After transferring the website, I activated the W3 Total Cache plugin and the Cloudflare plugin. The latter is the only solution for a free Cloudflare account to clear the cache for a specific part of the site, not only for the entire site, as you can select “Purge Everything” from the Cloudflare web interface. For example, if you have an aggressively set cache for many hours in Cloudflare’s Page Rules, when you post a new article on the blog or make changes to the site’s code, those changes won’t be visible until you clear the cache or the configured Browser cache TTL will expire.

If you use the Cloudflare plugin for WordPress, it will automatically clear everything that needs to be cleared, and if there’s any mishap, you can always manually purge the cache for a specific page, not the entire site. It doesn’t make sense to use Cloudflare cache if you keep clearing it all the time. Moreover, you unnecessarily load the hosting resources if you keep hitting “Purge Everything” after every article you write.

I activated these two plugins because I had deactivated them before moving the files from the old hosting to avoid any issues. I also paused the Cloudflare CDN/protection to prevent any potential problems, which indeed occurred after the transfer. As soon as I activated the Cloudflare protection, I couldn’t access the site anymore. When I tried to access my blog using the Chrome browser, instead of loading the site, the index.php file was downloaded.

I solved the problem by deleting the last lines from the .htaccess file that were related to PHP 7.4 and its path, which was different from the current one. The old hosting used LiteSpeed Enterprise web server, while I use OpenLiteSpeed web server, and PHP 7.4 was located elsewhere on my VPS. After removing the lines that you can see in the screenshot below, the error disappeared, and I was able to activate both the plugins and the Cloudflare protection. The problem that I don’t understand is why the file download error only occurred when I resumed Cloudflare instead of being consistently present. The ways of IT are sometimes strange…

How to fix my website is downloading index.php instead of loading the website

Delete all the lines starting with # php, at the end of your htaccess file, to fix the error when your blog is downloading index.php in Chrome instead of normally loading

The second error was that I was missing quite a few images from my blog, randomly. Both thumbnails and large pictures were missing. The absence of the images seemed random; there was no specific pattern. I thought that when I selected “select all” in cPanel for the files in public_html, to make them a zip file, the old shared web hosting encountered an error because the server was a bit slow, and it didn’t copy all the files since they didn’t physically exist in CyberPanel. Unfortunately, when I logged back into the cPanel of the old web hosting, I found that the images were not there either.

Some images and pictures are missing from my site after I changed my web hosting. Why?

Picture missing from my blog because of W3 Total Cache WordPress plugin

So, the question arises: where are the images?

Some time passed, and then I discovered that the culprit for these issues was the W3 Total Cache plugin.

Because of it, the images didn’t physically exist in wp-content/uploads; they were stored in cache files of W3 Total Cache. It was very strange and unpleasant for this to happen. On this occasion, I also decided to give up on using the W3 Total Cache plugin. It served me impeccably for many years, but this error made me no longer want to use it. I am the kind of person who, when finding the best optimization for his site, leaves it as it is and doesn’t make further changes because, based on experience… instead of improving things (if possible), you risk breaking them.

I found the best settings for W3 Total Cache back in 2013 when I started the blog, and they remained the same since then. Unfortunately, W3 Total Cache has not been the most capable cache plugin for a long time, as it is known that the winning combination for fast website loading and how to handle as many requests per second on your blog is between LiteSpeed Enterprise or OpenLiteSpeed web servers and the LiteSpeed Cache plugin for WordPress. For now, nothing surpasses these when it comes to fast websites, and you know that I am passionate about optimizing websites for quick loading.

So, I thought that on this occasion, I should switch to more technologically advanced solutions since now I have fast hosting. I am not yet fully familiar with the LiteSpeed Cache plugin, but for starters, I am very pleased with how the blog loads using this extension and OpenLiteSpeed web server. The LiteSpeed Cache plugin has many speed-boosting options that I haven’t tried yet, and it looks very modern.

Plus, LiteSpeed Cache WordPress plugin is compatible with the Cloudflare plugin, even though when you activate the Cloudflare plugin, an error may appear suggesting that conflicts could occur between them.

There are no conflicts between these two as long as you don’t use some dubious settings. I know that the LiteSpeed Cache plugin has a Cloudflare section, but unlike the Cloudflare plugin for WordPress, it only has the “Purge Everything” option when it comes to cache; you can’t clear the cache for individual files on the site.

Returning to the problem about missing images on the site, I had to go through hundreds of articles one by one because, as I mentioned before, the missing images didn’t follow any specific pattern. So, it was quite challenging to fix everything as it should be, but being a perfectionist and detail-oriented, it is unacceptable for me not to have everything in order.

I hope my advice has helped you if you encounter similar issues when switching from shared hosting with cPanel to unmanaged VPS with CyberPanel.

Since this is the first article written on the blog from the web hosting in Dallas, I also need to ask you some things: How does my site load for you there? Where are you located? Have you had similar problems when transferring your site or did you hire someone skilled to do the transfer for you?

If You Enjoy What You Have Read And Would Like To Help Us, Consider Visiting Our Premium Domain Names PORTFOLIO And Share It On Social Networks Or Tell The World About This Article. Also, You Can Leave A Comment Below.

Leave a Reply

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