How to Fix a WordPress HTTP Error

In WordPress, one of the common errors that might pop us is a general HTTP error. This will usually cause an upload to fail. It can often cause frustration as users can spend a lot of time finding the right content to upload to their WordPress site, only to be left with an error in return.

The HTTP error is generally easy to fix, and we will explain what it is and show you a few simple ways to do that.

What Is the HTTP Error?

Generally speaking, the HTTP error occurs when something goes wrong while uploading a file.

Unfortunately, while a browser will usually provide a code for the error to help you diagnose what happened, WordPress can sometimes fail to figure out precisely where in the process an error occurred.

In that case, a generic message will be produced, and you are simply left with an unhelpful line of text to stare at.

HTTP errors can be caused either by the client (you) or the background infrastructure (server). Unfortunately, since the precise cause is unknown, you have to try every available solution until you find the one that works.

1. Confirm the Error Is Persistent

If this error pops up once, it may be that your connection simply got reset or the WordPress servers experienced a short downtime. The issue may resolve itself simply by waiting a bit, so try uploading the file again in a few minutes.

If this works, then it’s almost certain that the error was due to a temporary server outage and you should have no further problems with it.

2. Remove Any Special Characters

The file you’re trying to upload may have special characters in its name that the server cannot parse correctly and is throwing an error in response. Characters such as semicolons and brackets can be removed. If the upload succeeds after you’ve renamed the file in question, then you know the error was due to one of these special characters, and you will know what to do in the future.

It’s also possible that changing your file’s extension will do the trick. Consider uploading a .png image instead of a .jpg, and see if that solves your problems.

3. Use a Different Browser

This might sound counter-intuitive, but sometimes a browser simply stops working for a page and there’s little you can do about it. This might be due to some background information requiring an update and the browser not recognizing it.

If you’re using Chrome, try switching to Firefox or Edge (Microsoft Edge is installed by default, so you don’t need to download anything). If this solves the uploading problem, you may want to stick to the browser that works for the near future. Your other browser’s next update should fix the issue.

If this doesn’t work, carry on with the fixes below.

4. Deactivate any Plugins

If your HTTP error occurred after you’ve installed a plugin for your WordPress, it’s most likely the culprit. Your best chance at fixing the error is to deactivate that plugin. Some image optimization plugins can cause this error, so those can be deactivated as well.

It’s best to deactivate plugins one at a time. That way you can precisely figure out what plugin is causing the issue to begin with. If you succeed in uploading a file once you’ve disabled a plugin, try to look for alternatives or contact the plugin developers to troubleshoot it.

If the problems persist after all plugins have been disabled, proceed with the following steps. Only re-enable plugins after the error disappeared, just in case.

5. Increase WordPress Memory Limit

You may not be able to upload a file simply because WordPress is running out of the memory needed to process it properly. Lack of memory can also cause other issues.

To increase your memory limit, you need to find the wp-config.php file and add the following line:

define (‘WP_MEMORY_LIMIT’, ‘256M’);

However, before you do this, you will want to confirm the memory size with your WordPress host.

6. Change WordPress’ Default Editor

WordPress comes with two different image editors. The main one is Imagick, and it usually works great. However, when an HTTP error occurs, Imagick may be the reason behind it.

The backup image editor, GD Library, can be substituted in cases like these. To do so, add the following code to your theme’s functions.php file:

function hs_image_editor_default_to_gd($editors ) {

$gd_editor = ‘WP_Image_Editor_GD’;

$editors = array_diff( $editors, array( $gd_editor ) );

array_unshift( $editors, $gd_editor );

return $editors;

}

add_filter( ‘wp_image_editors’, ‘hs_image_editor_default_to_gd’ );

If the error disappears, continue using GD Library as your primary and you should have fewer problems. If not, revert the changes made and continue with the next step.

7. Editing .htaccess

This file is sort of a keeper for your WordPress. It makes sure that everything else is in order and located in the WordPress root folder. Try adding this piece of code into the file to see if it fixes the HTTP error:

SetEnv MAGICK_THREAD_LIMIT 1

If it doesn’t, you can also try adding the following two snippets of code. Make sure you try each of them separately, saving and rechecking if the error persists after each attempt.

Option 1

<IfModule mod_security.c>

SecFilterEngine Off

SecFilterScanPOST Off

</IfModule>

Option 2

# Exclude the file upload and WP CRON scripts from authentication

<FilesMatch “(async-upload\.php|wp-cron\.php|xmlrpc\.php)$”>

Satisfy Any

Order allow, deny

Allow from all

Deny from none

</FilesMatch>

If none of these fixes work, revert any changes made to the file and continue to the next solution.

8. Clear Your Browser Cache

Your browser may be still keeping old files instead of some fresh pieces. To refresh some of the background data WordPress is using, try clearing your browser’s cache.

9. Check Your PHP Version

To work, WordPress requires PHP 7.4 or greater. Make sure that your version is up to date, or at least has this minimal requirement.

To change or update your PHP version, try looking at your Control Panel for the option or ask your host to change the version for you.

10. Check Media Library Path

The HTTP error can also appear if your uploads are not going to the proper place. This might happen if you’ve recently changed something to your development process.

To check your upload path, go to “Media” and then “Settings” in your WordPress dashboard. Uploaded files should be stored by default in the “/wp-content/uploads” folder.

If you don’t see a library path specified in these settings, then this shouldn’t be a problem and you’re using the default settings. If the library path is specified, try switching to the default and see if that fixes the problem.

11. Install the Add from Server Plugin

If nothing works, WordPress offers a plugin that might help. The Add from Server plugin should circumvent the traditional upload process and go around the error.

However, this plugin might not solve your problems and it might exacerbate some of the other issues. Use it at your own risk, and read the documentation it comes with.

12. Contact Your Host

If none of these work, contact your WordPress host and let them know about the issue you’re having. They will have more options at their disposal, and you should sometimes let someone else fix problems that you are unable to.

Additionally, you can try going to WordPress support to see if there are any new solutions.

One Step at a Time

As you can see, there are quite a few things that you can do to fix the HTTP error on WordPress. Since it’s a very broad error, the steps to remove it can vary. Hopefully, you were able to fix the HTTP error on your computer. If you haven’t, it might be time to change your WordPress host.

If you have found a solution that wasn’t covered here, feel free to leave a comment and let us know.

Was this article helpful?

Related Articles